-
Notifications
You must be signed in to change notification settings - Fork 9
/
webform.install
60 lines (54 loc) · 1.65 KB
/
webform.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @file
* Install, update and uninstall functions for the Webform module.
*/
// 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';
/**
* 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();
}
/**
* Implements hook_schema().
*
* Even though Webform's are config entities we need to create a 'webform' table
* to track webform submission serial numbers using DB transaction locking.
*
* @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'],
];
return $schema;
}