function field_conditional_state_menu in Field Conditional States 7.2
Same name and namespace in other branches
- 7 field_conditional_state.module \field_conditional_state_menu()
Implements hook_menu().
File
- ./
field_conditional_state.module, line 554 - Main functions of this module.
Code
function field_conditional_state_menu() {
$items = array();
foreach (entity_get_info() as $entity_type => $entity_info) {
if ($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'];
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';
}
$field_position = count(explode('/', $path)) + 1;
$items[$path . '/fields/%field_ui_menu/field_conditional_state'] = array(
'load arguments' => array(
$entity_type,
$bundle_arg,
$bundle_pos,
'%map',
),
'title' => 'Conditional states',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'field_conditional_state_settings_form',
$field_position,
),
'type' => MENU_LOCAL_TASK,
'access arguments' => array(
'administer field_conditional_state',
),
'weight' => 4,
'file' => 'field_conditional_state.admin.inc',
);
}
}
}
}
$items['admin/reports/fields/list'] = array(
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/reports/fields/conditional-states'] = array(
'title' => 'Conditional states',
'description' => 'Overview of fields on all entity types with a conditional state.',
'page callback' => 'field_conditional_state_fields_list',
'access arguments' => array(
'administer field_conditional_state',
),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
);
return $items;
}