function _menu_views_form_validate in Menu Views 8.3
Same name and namespace in other branches
- 7.2 menu_views.admin.inc \_menu_views_form_validate()
Validate handler for menu_edit_item form.
1 string reference to '_menu_views_form_validate'
- _menu_views_form_alter in ./
menu_views.admin.inc - Alters existing forms in preparation for adding Menu Views to it.
File
- ./
menu_views.admin.inc, line 581 - Form hooks for the menu_views module.
Code
function _menu_views_form_validate($form, &$form_state) {
// Only run this validation when the form is fully submitted.
if ($form_state['submitted']) {
$item = _menu_views_get_item($form, $form_state);
if ($item['type'] == 'view') {
if (!$item['view']['name']) {
form_set_error(implode('][', _menu_views_form_parents($form)) . '][name', t('The menu item type for this @type is a view. A view name is required before this @type can be saved.', array(
'@type' => isset($form['#node']) ? 'node' : 'menu item',
)));
}
elseif (!$item['view']['display']) {
form_set_error(implode('][', _menu_views_form_parents($form)) . '][display', t('The menu item type for this @type is a view. A view display is required before this @type can be saved.', array(
'@type' => isset($form['#node']) ? 'node' : 'menu item',
)));
}
}
}
}