function menu_views_menu_edit_item_validate in Menu Views 7
Validate handler for menu_edit_item form
1 string reference to 'menu_views_menu_edit_item_validate'
- menu_views_form_menu_edit_item_alter in includes/
form.inc - Implements hook_form_FORM_ID_alter(). Change path description. Insert the views selection.
File
- includes/
form.inc, line 154 - Form hooks for the menu_views module.
Code
function menu_views_menu_edit_item_validate($form, &$form_state) {
// Only run this validation when the form is fully submitted.
if ($form_state['submitted']) {
if ($form_state['values']['link_path'] == '<view>') {
$view = menu_views($form, $form_state);
if (!$view->name) {
form_set_error($view
->formParents() . 'name', t('The link path has been set to %view. You must select a view to attach to this menu item.', array(
'%view' => '<view>',
)));
}
}
}
}