function og_menu_edit_menu_form_submit in Organic Groups Menu (OG Menu) 7.2
Same name and namespace in other branches
- 6.2 og_menu.module \og_menu_edit_menu_form_submit()
- 6 og_menu.module \og_menu_edit_menu_form_submit()
- 7.3 og_menu.module \og_menu_edit_menu_form_submit()
Submit handler used on various forms.
2 string references to 'og_menu_edit_menu_form_submit'
- og_menu_edit_menu_form in ./
og_menu.pages.inc - Menu callback; Build the form that handles the adding/editing of a custom menu.
- og_menu_form_menu_edit_menu_alter in ./
og_menu.module - Implements hook_form_FORMID_alter().
File
- ./
og_menu.module, line 838 - Integrates Menu with Organic Groups. Lots of menu forms duplication in OG context.
Code
function og_menu_edit_menu_form_submit($form, &$form_state) {
$menu_name = $form_state['values']['menu_name'];
$value = $form_state['values']['og_menu_gid'];
if (!empty($value)) {
// Add 'menu-' if this is a new menu
if (strncmp($menu_name, 'menu-', 5) != 0) {
$menu_name = 'menu-' . $menu_name;
}
if (is_numeric($value)) {
og_menu_update_menu($menu_name, $value);
}
else {
preg_match('/^(?:\\s*|(.*) )?\\[\\s*gid\\s*:\\s*(\\d+)\\s*\\]$/', $value, $matches);
if (!empty($matches)) {
$value = $matches[count($matches) - 1];
if (is_numeric($value)) {
og_menu_update_menu($menu_name, $value);
}
}
else {
drupal_set_message(t('Cannot assign menu to invalid group, please retry'), 'error');
}
}
}
}