You are here

function menu_link_field_schema in Menu Link (Field) 7

Implements hook_field_schema().

File

./menu_link.install, line 11
Install, update and uninstall functions for the Menu link module.

Code

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;
}