142 lines
3.8 KiB
Plaintext
142 lines
3.8 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Install, update and uninstall functions for the shortcut module.
|
|
*/
|
|
|
|
use Drupal\Core\Database\Database;
|
|
use Drupal\Core\Language\Language;
|
|
|
|
/**
|
|
* Implements hook_schema().
|
|
*/
|
|
function shortcut_schema() {
|
|
$schema['shortcut'] = array(
|
|
'description' => 'Stores shortcut items.',
|
|
'fields' => array(
|
|
'id' => array(
|
|
'type' => 'serial',
|
|
'not null' => TRUE,
|
|
'description' => 'Primary Key: Unique shortcut ID.',
|
|
),
|
|
'uuid' => array(
|
|
'type' => 'varchar',
|
|
'length' => 128,
|
|
'not null' => FALSE,
|
|
'description' => 'Unique Key: Universally unique identifier for this shortcut.',
|
|
),
|
|
'shortcut_set' => array(
|
|
'type' => 'varchar',
|
|
'length' => 32,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
'description' => 'The bundle of the shortcut.',
|
|
),
|
|
'langcode' => array(
|
|
'type' => 'varchar',
|
|
'length' => 12,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
'description' => 'The {language}.langcode of the original variant of this shortcut.',
|
|
),
|
|
'weight' => array(
|
|
'description' => 'Weight among shortcuts in the same shortcut set.',
|
|
'type' => 'int',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
),
|
|
'route_name' => array(
|
|
'description' => 'The machine name of a defined Symfony Route this menu item represents.',
|
|
'type' => 'varchar',
|
|
'length' => 255,
|
|
),
|
|
'route_parameters' => array(
|
|
'description' => 'Serialized array of route parameters of this shortcut.',
|
|
'type' => 'blob',
|
|
'size' => 'big',
|
|
'not null' => FALSE,
|
|
'serialize' => TRUE,
|
|
),
|
|
),
|
|
'primary key' => array('id'),
|
|
'unique keys' => array(
|
|
'uuid' => array('uuid'),
|
|
),
|
|
);
|
|
|
|
$schema['shortcut_field_data'] = array(
|
|
'description' => 'Stores shortcut properties.',
|
|
'fields' => array(
|
|
'id' => array(
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'description' => 'The {shortcut}.id of the shortcut.',
|
|
),
|
|
'langcode' => array(
|
|
'type' => 'varchar',
|
|
'length' => 12,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
'description' => 'The {language}.langcode of this variant of this shortcut.',
|
|
),
|
|
'default_langcode' => array(
|
|
'type' => 'int',
|
|
'not null' => TRUE,
|
|
'default' => 1,
|
|
'description' => 'Boolean indicating whether the current variant is in the original entity language.',
|
|
),
|
|
'title' => array(
|
|
'type' => 'varchar',
|
|
'length' => 32,
|
|
'not null' => FALSE,
|
|
'description' => 'The title of the shortcut.',
|
|
),
|
|
),
|
|
'foreign keys' => array(
|
|
'shortcut' => array(
|
|
'table' => 'shortcut',
|
|
'columns' => array('id' => 'id'),
|
|
),
|
|
),
|
|
'primary key' => array('id', 'langcode'),
|
|
);
|
|
|
|
$schema['shortcut_set_users'] = array(
|
|
'description' => 'Maps users to shortcut sets.',
|
|
'fields' => array(
|
|
'uid' => array(
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
'description' => 'The {users}.uid for this set.',
|
|
),
|
|
'set_name' => array(
|
|
'type' => 'varchar',
|
|
'length' => 32,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
'description' => "The {shortcut_set}.set_name that will be displayed for this user.",
|
|
),
|
|
),
|
|
'primary key' => array('uid'),
|
|
'indexes' => array(
|
|
'set_name' => array('set_name'),
|
|
),
|
|
'foreign keys' => array(
|
|
'set_user' => array(
|
|
'table' => 'users',
|
|
'columns' => array('uid' => 'uid'),
|
|
),
|
|
'set_name' => array(
|
|
'table' => 'shortcut_set',
|
|
'columns' => array('set_name' => 'set_name'),
|
|
),
|
|
),
|
|
);
|
|
|
|
return $schema;
|
|
}
|