function date_repeat_field_menu in Date 8
Same name and namespace in other branches
- 7.3 date_repeat_field/date_repeat_field.module \date_repeat_field_menu()
- 7.2 date_repeat_field/date_repeat_field.module \date_repeat_field_menu()
Implements hook_menu().
Add menu tabs to display pages with details about repeating date values.
File
- date_repeat_field/
date_repeat_field.module, line 73 - Creates the option of Repeating date fields and manages Date fields that use the Date Repeat API.
Code
function date_repeat_field_menu() {
$items = array();
$values = date_repeat_field_bundles();
foreach ($values as $entity_type => $bundles) {
if (module_exists('field_collection') && $entity_type == 'field_collection_item') {
foreach ($bundles as $bundle => $fields) {
$field = field_info_field($bundle);
if ($field['type'] == 'field_collection') {
$path = field_collection_field_get_path($field);
$count = count(explode('/', $path));
$items[$path . '/%field_collection_item/repeats'] = array(
'title' => 'Repeats',
'page callback' => 'date_repeat_field_page',
'page arguments' => array(
$entity_type,
$count,
),
'access callback' => 'date_repeat_field_show',
'access arguments' => array(
$entity_type,
$count,
),
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
);
}
}
}
else {
$path = $entity_type . '/%' . $entity_type;
$items[$path . '/repeats'] = array(
'title' => 'Repeats',
'page callback' => 'date_repeat_field_page',
'page arguments' => array(
$entity_type,
1,
),
'access callback' => 'date_repeat_field_show',
'access arguments' => array(
$entity_type,
1,
),
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
);
}
}
return $items;
}