You are here

function entity_menu_links_entity_info in Entity menu links 7

Implements hook_entity_info().

File

./entity_menu_links.module, line 10
Entity menu link module

Code

function entity_menu_links_entity_info() {
  $info['menu_link'] = array(
    'label' => t('Menu link'),
    'controller class' => 'EntityMenuLinkController',
    'base table' => 'menu_links',
    'module' => 'entity_menu_links',
    'revision table' => 'menu_links_revision',
    'uri callback' => 'entity_menu_links_uri',
    'label callback' => 'entity_menu_links_label',
    'fieldable' => FALSE,
    'entity keys' => array(
      'id' => 'mlid',
      'revision' => 'vid',
      'bundle' => 'menu_name',
      'label' => 'title',
      'uuid' => 'uuid',
      'revision uuid' => 'vuuid',
    ),
    'bundles' => array(),
    'view modes' => array(),
    'load hook' => NULL,
    'uuid' => TRUE,
  );
  $schema = drupal_get_schema('menu_links');
  if (isset($schema['fields']['language'])) {
    $info['menu_link']['entity keys']['language'] = 'language';
  }
  foreach (menu_get_menus() as $type => $name) {
    $info['menu_link']['bundles'][$type] = array(
      'label' => t('@menu-name menu', array(
        '@menu-name' => $name,
      )),
      'admin' => array(
        'path' => 'admin/structure/menu/manage/%menu/edit',
        'bundle argument' => 4,
        'real path' => 'admin/structure/menu/manage/' . $type . '/edit',
        'access arguments' => array(
          'administer menus',
        ),
      ),
    );
  }
  return $info;
}