function flexiform_menu_alter in Flexiform 7
Implements hook_menu_alter()
Allow displays to alter the menu.
File
- ./
flexiform.module, line 83 - Module for the Flexiform system.
Code
function flexiform_menu_alter(&$items) {
$displays = flexiform_display_info();
$hook_menu_displays = array();
foreach ($displays as $name => $info) {
if (method_exists($info['class'], 'hook_menu_alter')) {
$hook_menu_displays[] = $name;
}
}
if ($hook_menu_displays) {
/** @var \FlexiformController $controller */
$controller = entity_get_controller('flexiform');
foreach ($controller
->loadWithDisplay($displays) as $form) {
foreach ($hook_menu_displays as $name) {
if (($display = $form
->getDisplay($name)) && $display
->isEnabled()) {
$display
->hook_menu_alter($items);
}
}
}
}
// Alter comment bits.
// Adjust the Field UI tabs on admin/structure/types/manage/[node-type].
// See comment_entity_info().
if (!empty($items['admin/structure/types/manage/%comment_node_type/comment/fields']['title'])) {
$items['admin/structure/types/manage/%comment_node_type/comment/fields']['title'] = 'Comment fields';
$items['admin/structure/types/manage/%comment_node_type/comment/fields']['weight'] = 4;
}
if (!empty($items['admin/structure/types/manage/%comment_node_type/comment/display']['title'])) {
$items['admin/structure/types/manage/%comment_node_type/comment/display']['title'] = 'Comment display';
$items['admin/structure/types/manage/%comment_node_type/comment/display']['weight'] = 5;
}
if (!empty($items['admin/structure/types/manage/%comment_node_type/comment/forms']['title'])) {
$items['admin/structure/types/manage/%comment_node_type/comment/forms']['title'] = 'Comment forms';
$items['admin/structure/types/manage/%comment_node_type/comment/forms']['weight'] = 6;
}
}