You are here

function eck__entity_type__menu in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7 eck.entity_type.inc \eck__entity_type__menu()
  2. 7.2 eck.entity_type.inc \eck__entity_type__menu()

Passthrough from hook_menu().

It creates the menu items related to entity type management.

1 call to eck__entity_type__menu()
eck_menu in ./eck.module
Implements hook_menu().

File

./eck.entity_type.inc, line 18
ENTITY TYPE

Code

function eck__entity_type__menu() {
  $menu = array();
  $path = eck__entity_type__path();

  // OVERVIEW Entity Type.
  // View all of the created entity types.
  $menu[$path] = array(
    'title' => 'Entity types',
    'description' => 'A centralized administrative section for entity types',
    'page callback' => 'eck__entity_type__list',
    'access callback' => 'eck_access',
    'access arguments' => array(
      "list",
      "entity_type",
    ),
    'file' => 'eck.entity_type.inc',
  );

  // ADD Entity.
  $menu["{$path}/add"] = array(
    'title' => 'Add entity type',
    'description' => 'Add a new entity type',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'eck__entity_type__form',
    ),
    'access callback' => 'eck_access',
    'access arguments' => array(
      "create",
      "entity_type",
    ),
    'type' => MENU_LOCAL_ACTION,
    'weight' => -1,
    'file' => 'eck.entity_type.inc',
  );
  module_load_include('inc', 'eck', 'eck.bundle');

  // Each entity type can have multiple bundles.
  // Now lets create the menus for the bundle administration of each
  // entity type.
  foreach (EntityType::loadAll() as $entity_type) {
    $menu = array_merge($menu, eck__bundle__menu($entity_type));
  }
  return $menu;
}