You are here

menu_link.install in Menu Link (Field) 7

Same filename and directory in other branches
  1. 8 menu_link.install
  2. 2.0.x menu_link.install

Install, update and uninstall functions for the Menu link module.

File

menu_link.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the Menu link module.
 */

/**
 * Implements hook_field_schema().
 */
function menu_link_field_schema($field) {
  $menu_links = drupal_get_schema_unprocessed('system', 'menu_links');
  $schema = array(
    'columns' => array(
      'mlid' => array(
        'description' => 'The {menu_links}.mlid being referenced in this field.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      // Columns below are being used for revision control.
      'menu_name' => $menu_links['fields']['menu_name'],
      'plid' => $menu_links['fields']['plid'],
      'link_path' => $menu_links['fields']['link_path'],
      'link_title' => $menu_links['fields']['link_title'],
      'options' => $menu_links['fields']['options'],
      'hidden' => $menu_links['fields']['hidden'],
      'expanded' => $menu_links['fields']['expanded'],
      'weight' => $menu_links['fields']['weight'],
    ),
    'indexes' => array(
      'mlid' => array(
        'mlid',
      ),
      'menu_plid' => array(
        'menu_name',
        'plid',
      ),
    ),
    'foreign keys' => array(
      'menu_link' => array(
        'table' => 'menu_links',
        'columns' => array(
          'mlid' => 'mlid',
        ),
      ),
      'parent_menu_link' => array(
        'table' => 'menu_links',
        'columns' => array(
          'plid' => 'mlid',
        ),
      ),
    ),
  );
  if (module_exists('menu')) {
    $schema['foreign keys']['menu'] = array(
      'table' => 'menu_custom',
      'columns' => array(
        'menu_name' => 'menu_name',
      ),
    );
  }
  return $schema;
}

Functions

Namesort descending Description
menu_link_field_schema Implements hook_field_schema().