This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/web/modules/contrib/webform/webform.install

65 lines
1.8 KiB
Plaintext
Raw Normal View History

2017-03-16 15:29:07 +00:00
<?php
/**
* @file
* Install, update and uninstall functions for the Webform module.
*/
2018-11-23 12:29:20 +00:00
// Webform install helper functions.
include_once 'includes/webform.install.inc';
// Webform requirements.
include_once 'includes/webform.install.requirements.inc';
// Webform update hooks.
include_once 'includes/webform.install.update.inc';
2017-03-16 15:29:07 +00:00
/**
* Implements hook_uninstall().
*/
function webform_uninstall() {
// Issue #2793597: uninstall error You have requested a non-existent service
// "webform.email_provider".
// Workaround: Don't use the webform.email_provider in hook_uninstall().
// @see \Drupal\webform\WebformEmailProvider::uninstall()
$config = \Drupal::configFactory()->getEditable('system.mail');
$mail_plugins = $config->get('interface');
unset($mail_plugins['webform']);
$config->set('interface', $mail_plugins)->save();
2018-11-23 12:29:20 +00:00
// Delete editor uploaded files.
$config = \Drupal::configFactory()->get('webform.settings');
_webform_config_delete($config);
2017-03-16 15:29:07 +00:00
}
/**
2018-11-23 12:29:20 +00:00
* Implements hook_schema().
2017-03-16 15:29:07 +00:00
*
2018-11-23 12:29:20 +00:00
* Even though Webform's are config entities we need to create a 'webform' table
* to track webform submission serial numbers using DB transaction locking.
2017-03-16 15:29:07 +00:00
*
2018-11-23 12:29:20 +00:00
* @see \Drupal\webform\WebformEntityStorage
*/
function webform_schema() {
$schema['webform'] = [
'description' => 'Stores all webform data.',
'fields' => [
'webform_id' => [
'description' => 'The webform id.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
],
'next_serial' => [
'description' => 'The serial number to give to the next submission to this webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
],
],
'primary key' => ['webform_id', 'next_serial'],
2017-03-16 15:29:07 +00:00
];
2018-11-23 12:29:20 +00:00
return $schema;
2017-03-16 15:29:07 +00:00
}