comparison core/modules/shortcut/shortcut.install @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 <?php
2
3 /**
4 * @file
5 * Install, update and uninstall functions for the shortcut module.
6 */
7
8 /**
9 * Implements hook_schema().
10 */
11 function shortcut_schema() {
12 $schema['shortcut_set_users'] = [
13 'description' => 'Maps users to shortcut sets.',
14 'fields' => [
15 'uid' => [
16 'type' => 'int',
17 'unsigned' => TRUE,
18 'not null' => TRUE,
19 'default' => 0,
20 'description' => 'The {users}.uid for this set.',
21 ],
22 'set_name' => [
23 'type' => 'varchar_ascii',
24 'length' => 32,
25 'not null' => TRUE,
26 'default' => '',
27 'description' => "The {shortcut_set}.set_name that will be displayed for this user.",
28 ],
29 ],
30 'primary key' => ['uid'],
31 'indexes' => [
32 'set_name' => ['set_name'],
33 ],
34 'foreign keys' => [
35 'set_user' => [
36 'table' => 'users',
37 'columns' => ['uid' => 'uid'],
38 ],
39 'set_name' => [
40 'table' => 'shortcut_set',
41 'columns' => ['set_name' => 'set_name'],
42 ],
43 ],
44 ];
45
46 return $schema;
47 }
48
49 /**
50 * Implements hook_install().
51 */
52 function shortcut_install() {
53 // Theme settings are not configuration entities and cannot depend on modules
54 // so to set a module-specific setting, we need to set it with logic.
55 if (\Drupal::service('theme_handler')->themeExists('seven')) {
56 \Drupal::configFactory()->getEditable('seven.settings')->set('third_party_settings.shortcut.module_link', TRUE)->save(TRUE);
57 }
58 }
59
60 /**
61 * Implements hook_uninstall().
62 */
63 function shortcut_uninstall() {
64 // Theme settings are not configuration entities and cannot depend on modules
65 // so to unset a module-specific setting, we need to unset it with logic.
66 if (\Drupal::service('theme_handler')->themeExists('seven')) {
67 \Drupal::configFactory()->getEditable('seven.settings')->clear('third_party_settings.shortcut')->save(TRUE);
68 }
69 }