function msnf_menu in Multistep Nodeform 7
Same name and namespace in other branches
- 6 msnf.module \msnf_menu()
Implements hook_menu().
File
- ./
msnf.module, line 11 - Main functions for module "Multistep Nodeform".
Code
function msnf_menu() {
$items = array();
// Ensure the following is not executed until field_bundles is working and
// tables are updated. Needed to avoid errors on initial installation.
if (defined('MAINTENANCE_MODE')) {
return $items;
}
// Create tabs for all possible bundles.
foreach (entity_get_info() as $entity_type => $entity_info) {
if (isset($entity_info['fieldable']) && $entity_info['fieldable']) {
foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
if (isset($bundle_info['admin'])) {
// Extract path information from the bundle.
$path = $bundle_info['admin']['path'];
// Extract the argument position of the bundle name string
// ('bundle argument') and pass that position to the menu loader. The
// position needs to be casted into a string; otherwise it would be
// replaced with the bundle name string.
if (isset($bundle_info['admin']['bundle argument'])) {
$bundle_arg = $bundle_info['admin']['bundle argument'];
$bundle_pos = (string) $bundle_arg;
}
else {
$bundle_arg = $bundle_name;
$bundle_pos = '0';
}
// This is the position of the %msnf_step_menu placeholder in the
// items below.
$argument_position = count(explode('/', $path)) + 1;
// Extract access information, providing defaults.
$access = array_intersect_key($bundle_info['admin'], drupal_map_assoc(array(
'access callback',
'access arguments',
)));
$access += array(
'access callback' => 'user_access',
'access arguments' => array(
'administer site configuration',
),
);
$items["{$path}/steps/%msnf_step_menu/delete"] = array(
'load arguments' => array(
$entity_type,
$bundle_arg,
$bundle_pos,
'%map',
),
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'msnf_delete_form',
$argument_position,
),
'type' => MENU_CALLBACK,
'file' => 'includes/msnf.field_ui.inc',
) + $access;
}
}
}
}
return $items;
}