function groupmenu_edit_item_form in Group Menu 7
Form callback; Build the menu link editing form.
1 string reference to 'groupmenu_edit_item_form'
- groupmenu_menu in ./
groupmenu.module - Implements hook_menu().
File
- ./
groupmenu.pages.inc, line 173 - Page callbacks for groupmenu.
Code
function groupmenu_edit_item_form($form, &$form_state, $type, $gid, $menu, $item = array()) {
module_load_include('inc', 'menu', 'menu.admin');
$form = menu_edit_item($form, $form_state, $type, $item, $menu);
$group = group_load($gid);
$label = $group
->label();
// Set the breadcrumb now to override menu_edit_item() breadcrumb.
$breadcrumbs = array();
$breadcrumbs[] = l(t('Home'), '/');
$breadcrumbs[] = l($label, 'group/' . $gid);
$breadcrumbs[] = l(t('Menus'), 'group/' . $gid . '/menus');
$breadcrumbs[] = l($menu['title'], 'group/' . $gid . '/menus/' . $menu['menu_name']);
drupal_set_breadcrumb($breadcrumbs);
$list = array();
$menus = groupmenu_get_group_menus(array(
$gid,
));
foreach ($menus as $option) {
$list[$option['menu_name']] = $option['title'];
}
// Set the title of the page.
drupal_set_title(t('Add item into menu !mtitle', array(
'!mtitle' => $menu['title'],
)), PASS_THROUGH);
// Build the form.
$form['parent']['#options'] = menu_parent_options($list, array(
'mlid' => 0,
));
$form['groupmenu_gid'] = array(
'#type' => 'value',
'#value' => $gid,
);
$form['groupmenu_name'] = array(
'#type' => 'value',
'#value' => $menu['menu_name'],
);
$form['#submit'][] = 'menu_edit_item_submit';
$form['#submit'][] = 'groupmenu_redirect';
$form['#validate'][] = 'menu_edit_item_validate';
if (!empty($item)) {
$form['actions']['delete'] = array(
'#type' => 'link',
'#title' => 'Delete',
'#href' => 'group/' . $gid . '/menus/' . $menu['menu_name'] . '/item/' . $item['mlid'] . '/delete',
'#weight' => 10,
);
}
return $form;
}