function page_manager_page_form_menu_validate
Validate handler for the menu form for add/edit page task.
File
-
page_manager/
plugins/ tasks/ page.admin.inc, line 788
Code
function page_manager_page_form_menu_validate(&$form, &$form_state) {
// If setting a 'normal' menu entry, make sure that any placeholders
// support the to_arg stuff.
if ($form_state['values']['menu']['type'] == 'normal') {
$page = $form_state['page']->subtask['subtask'];
foreach (explode('/', $page->path) as $bit) {
if (!isset($bit) || $bit === '') {
continue;
}
if ($bit[0] == '%') {
// Chop off that %.
$name = substr($bit, 1);
// Check to see if the argument plugin allows to arg:
if (!empty($page->arguments[$name])) {
ctools_include('context');
$plugin = ctools_get_argument($page->arguments[$name]['name']);
if (!empty($plugin['path placeholder to_arg'])) {
continue;
}
}
form_error($form['menu']['type'], t('Paths with non optional placeholders cannot be used as normal menu items unless the selected argument handler provides a default argument to use for the menu item.'));
return;
}
}
}
}