You are here

function eck__bundle__menu in Entity Construction Kit (ECK) 7

Same name and namespace in other branches
  1. 7.3 eck.bundle.inc \eck__bundle__menu()
  2. 7.2 eck.bundle.inc \eck__bundle__menu()

This function creates the menu items relevant to bundle administration

Parameters

$entity_type: (Object) as returned by eck__entity_type__load()

This function called is triggered from hook_menu()

See also

eck_menu()

1 call to eck__bundle__menu()
eck__entity_type__menu in ./eck.entity_type.inc
Passthrough from hook_menu().

File

./eck.bundle.inc, line 17
All of the menu, pages, and forms related to bundle administration.

Code

function eck__bundle__menu($entity_type) {

  // Create the menus relavant to types.
  $menu = array();

  // DELETE ENTITY TYPE
  $menu["admin/structure/eck/{$entity_type->name}/delete"] = array(
    'title' => "Delete a(n) '{$entity_type->label}'",
    'description' => "Delete the '{$entity_type->label}' Entity Type",
    'page callback' => "drupal_get_form",
    //"eck__entity_type__delete",
    'page arguments' => array(
      "eck__entity_type__delete_form",
      $entity_type,
    ),
    'access arguments' => array(
      "delete {$entity_type->name} entity type",
    ),
    'file' => 'eck.entity_type.inc',
  );
  $menu["admin/structure/eck/{$entity_type->name}/list"] = array(
    'title' => 'List',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );

  // $entity_type_object = eck__entity_type_load($entity_type);
  $menu["admin/structure/eck/{$entity_type->name}/edit"] = array(
    'title' => "Edit {$entity_type->label}",
    'description' => "Edit the '{$entity_type->label}' entity type",
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      "eck__entity_type__form",
      $entity_type->name,
    ),
    'access arguments' => array(
      "edit {$entity_type->name} entity type",
    ),
    'file' => 'eck.entity_type.inc',
    'type' => MENU_LOCAL_TASK,
  );

  // OVERVIEW Entity types.
  $menu["admin/structure/eck/{$entity_type->name}"] = array(
    'title' => "{$entity_type->label} Bundles",
    'description' => "View all the bundles for '{$entity_type->label}'",
    'page callback' => "eck__bundle__overview",
    'page arguments' => array(
      $entity_type,
    ),
    'access arguments' => array(
      "administer {$entity_type->name} bundles",
    ),
    'weight' => 0,
    'file' => 'eck.bundle.inc',
  );
  $menu["admin/structure/eck/{$entity_type->name}/add"] = array(
    'title' => "Add a(n) '{$entity_type->label}' Bundle ",
    'description' => "Add a(n) new '{$entity_type->label} Bundle'",
    'page callback' => "drupal_get_form",
    'page arguments' => array(
      'eck__bundle__add',
      $entity_type,
    ),
    'access arguments' => array(
      "add {$entity_type->name} bundles",
    ),
    'type' => MENU_LOCAL_ACTION,
    'weight' => 1,
    'file' => 'eck.bundle.inc',
  );
  module_load_include('inc', 'eck', 'eck.entity');
  foreach (eck__bundle__load($entity_type->name) as $bundle) {
    $menu = array_merge($menu, eck__entity__menu($entity_type, $bundle));
  }
  return $menu;
}