function og_menu_edit_menu_form in Organic Groups Menu (OG Menu) 7.3
Same name and namespace in other branches
- 6.2 og_menu.module \og_menu_edit_menu_form()
- 6 og_menu.module \og_menu_edit_menu_form()
- 7.2 og_menu.pages.inc \og_menu_edit_menu_form()
Menu callback.
Build the form that handles the adding/editing of a custom menu.
1 string reference to 'og_menu_edit_menu_form'
- og_menu_menu in ./
og_menu.module - Implements hook_menu().
File
- ./
og_menu.pages.inc, line 130 - Contains page callbacks for og_menu
Code
function og_menu_edit_menu_form($form, &$form_state, $type, $group_type, $gid, $menu = array()) {
module_load_include('inc', 'menu', 'menu.admin');
$entity_wrapper = entity_metadata_wrapper($group_type, $gid);
$label = $entity_wrapper
->label();
// Set the breadcrumb.
og_set_breadcrumb($group_type, $gid, array(
l(t('Group'), "{$group_type}/{$gid}/group"),
));
// Set the title of the page.
switch ($type) {
case 'add':
drupal_set_title(t('Add menu for @title', array(
'@title' => $label,
)), PASS_THROUGH);
break;
case 'edit':
drupal_set_title(t('Edit menu for @title', array(
'@title' => $label,
)), PASS_THROUGH);
break;
}
// Build the form.
$form = array();
$form = menu_edit_menu($form, $form_state, $type, $menu);
$form['og_menu_group_type'] = array(
'#type' => 'value',
'#value' => $group_type,
);
$form['og_menu_gid'] = array(
'#type' => 'value',
'#value' => $gid,
);
if ($type == 'edit') {
$form['og_menu_name'] = array(
'#type' => 'value',
'#value' => $menu['menu_name'],
);
}
// Add submit handlers.
$form['#submit'][] = 'menu_edit_menu_submit';
$form['#submit'][] = 'og_menu_edit_menu_form_submit';
$form['#submit'][] = 'og_menu_edit_menu_form_submit_redirect';
$form['actions']['delete']['#submit'][0] = 'og_menu_delete_menu_form_submit';
return $form;
}