function eck__bundle__menu in Entity Construction Kit (ECK) 7.3
Same name and namespace in other branches
- 7 eck.bundle.inc \eck__bundle__menu()
- 7.2 eck.bundle.inc \eck__bundle__menu()
This function creates the menu items relevant to bundle administration.
Parameters
/EntityType $entity_type: As returned by eck__entity_type__load().
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
Code
function eck__bundle__menu($entity_type) {
// Create the menus relavant to types.
$path = eck__entity_type__path();
$menu = array();
// EDIT an entity type.
$menu["{$path}/{$entity_type->name}/edit"] = array(
'title' => "Edit",
'description' => "Edit the '{$entity_type->label}' entity type",
'page callback' => 'drupal_get_form',
'page arguments' => array(
"eck__entity_type__form",
$entity_type->name,
),
'access callback' => 'eck_access',
'access arguments' => array(
'update',
'entity_type',
$entity_type,
),
'file' => 'eck.entity_type.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
// DELETE an entity type.
$menu["{$path}/{$entity_type->name}/delete"] = array(
'title' => "Delete",
'description' => "Delete the '{$entity_type->label}' Entity Type",
// "eck__entity_type__delete",
'page callback' => "drupal_get_form",
'page arguments' => array(
"eck__entity_type__delete_form",
$entity_type->name,
),
'access callback' => 'eck_access',
'access arguments' => array(
"delete",
"entity_type",
$entity_type,
),
'file' => 'eck.entity_type.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 3,
);
// MANAGE Entity Type Properties.
$menu["{$path}/{$entity_type->name}/property"] = array(
'title' => "Manage properties",
'description' => "Manage the properties of the {$entity_type->label} entity type",
'page callback' => "eck__properties",
'page arguments' => array(
$entity_type->name,
),
'access callback' => 'eck_access',
'access arguments' => array(
"update",
"property",
),
'file' => 'eck.properties.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 4,
);
// Add a property.
$menu["{$path}/{$entity_type->name}/property/add"] = array(
'title' => "Add property",
'description' => "Add a property of the {$entity_type->label} entity type",
'page callback' => "drupal_get_form",
'page arguments' => array(
"eck__property_add__form",
$entity_type->name,
),
'access callback' => 'eck_access',
'access arguments' => array(
"update",
"property",
),
'file' => 'eck.properties.inc',
'type' => MENU_LOCAL_ACTION,
'weight' => 4,
);
// Activate a default property.
$menu["{$path}/{$entity_type->name}/property/%/activate"] = array(
'title' => "Activate default property",
'page callback' => "eck__activate_default_property",
'page arguments' => array(
$entity_type->name,
5,
),
'access callback' => 'eck_access',
'access arguments' => array(
"update",
"property",
),
'file' => 'eck.default_properties.inc',
);
// Dectivate a default property.
$menu["{$path}/{$entity_type->name}/property/%/deactivate"] = array(
'title' => "Activate default property",
'page callback' => "eck__deactivate_default_property",
'page arguments' => array(
$entity_type->name,
5,
),
'access callback' => 'eck_access',
'access arguments' => array(
"update",
"property",
),
'file' => 'eck.default_properties.inc',
);
// Edit a property.
$menu["{$path}/{$entity_type->name}/property/%/edit"] = array(
'title' => "Edit property",
'description' => "Edit a property of the {$entity_type->label} entity type",
'page callback' => "drupal_get_form",
'page arguments' => array(
"eck__property_edit__form",
$entity_type->name,
5,
),
'access callback' => 'eck_access',
'access arguments' => array(
"update",
"property",
),
'file' => 'eck.properties.inc',
);
// Delete a property.
$menu["{$path}/{$entity_type->name}/property/%/delete"] = array(
'title' => "Delete property",
'description' => "Delete a property of the {$entity_type->label} entity type",
'page callback' => "drupal_get_form",
'page arguments' => array(
"eck__property_delete__form",
$entity_type->name,
5,
),
'access callback' => 'eck_access',
'access arguments' => array(
"update",
"property",
),
'file' => 'eck.properties.inc',
);
// Modify (add/change/delete) the behavior on a property.
// Edit a property.
$menu["{$path}/{$entity_type->name}/property/%/behavior"] = array(
'title' => "Edit property",
'description' => "Modify the behavior of a property of the {$entity_type->label} entity type",
'page callback' => "drupal_get_form",
'page arguments' => array(
"eck__property_behavior__form",
$entity_type->name,
5,
),
'access callback' => 'eck_access',
'access arguments' => array(
"update",
"property",
),
'file' => 'eck.properties.inc',
);
// LIST bundles of an entity type.
$menu["{$path}/{$entity_type->name}"] = array(
'title' => "{$entity_type->label}",
'description' => "View all the bundles for '{$entity_type->label}'",
'page callback' => "eck__bundle__list",
'page arguments' => array(
3,
),
'access callback' => 'eck_access',
'access arguments' => array(
'list',
'bundle',
$entity_type,
),
'file' => 'eck.bundle.inc',
);
$menu["{$path}/{$entity_type->name}/list"] = array(
'title' => 'Bundle List',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 100,
);
// ADD bundles to an entity type.
$menu["{$path}/{$entity_type->name}/add"] = array(
'title' => "Add bundle ",
'description' => "Add a(n) new '{$entity_type->label} Bundle'",
'page callback' => "drupal_get_form",
'page arguments' => array(
'eck__bundle__add',
3,
),
'access callback' => 'eck_access',
'access arguments' => array(
'create',
'bundle',
$entity_type,
),
'type' => MENU_LOCAL_ACTION,
'weight' => 0,
'file' => 'eck.bundle.inc',
);
module_load_include('inc', 'eck', 'eck.entity');
foreach (Bundle::loadByEntityType($entity_type) as $bundle) {
$menu = array_merge($menu, eck__entity__menu($entity_type, $bundle));
}
return $menu;
}