colossal_menu.install in Colossal Menu 2.x
Same filename and directory in other branches
Install, update and uninstall functions for the Colossal Menu.
File
colossal_menu.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Colossal Menu.
*/
/**
* Implements hook_schema().
*/
function colossal_menu_schema() {
return [
'colossal_menu_link_tree' => [
'description' => 'Colossal Menu Link Tree',
'fields' => [
'ancestor' => [
'description' => 'The current {colossal_menu_link_tree}.id ancestor.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'descendant' => [
'description' => 'The current {colossal_menu_link}.id descendant.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'depth' => [
'description' => 'The depth of the descendant compared to the ancestor.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
'indexes' => [
'colossal_menu_link_tree_ancestor' => [
'ancestor',
],
'colossal_menu_link_tree_descendant' => [
'descendant',
],
'colossal_menu_link_tree_depth' => [
'depth',
],
],
'foreign keys' => [
'colossal_menu_link_ancestor' => [
'table' => 'colossal_menu_link',
'columns' => [
'ancestor' => 'id',
],
],
'colossal_menu_link_descendant' => [
'table' => 'colossal_menu_link',
'columns' => [
'descendant' => 'id',
],
],
],
'primary key' => [
'ancestor',
'descendant',
],
],
];
}
/**
* Enable colossal_menu_rest module if rest_menu_tree is enabled.
*/
function colossal_menu_update_8001() {
if (\Drupal::moduleHandler()
->moduleExists('rest_menu_tree')) {
\Drupal::service('module_installer')
->install([
'colossal_menu_rest',
], TRUE);
}
}
Functions
Name | Description |
---|---|
colossal_menu_schema | Implements hook_schema(). |
colossal_menu_update_8001 | Enable colossal_menu_rest module if rest_menu_tree is enabled. |