function menu_breadcrumb_admin_settings_form_validate in Menu Breadcrumb 7
Same name and namespace in other branches
- 6 menu_breadcrumb.module \menu_breadcrumb_admin_settings_form_validate()
Form validation handler.
File
- ./
menu_breadcrumb.module, line 561 - The main file for the menu_breadcrumb module.
Code
function menu_breadcrumb_admin_settings_form_validate($form, &$form_state) {
$patterns =& $form_state['values']['menu_breadcrumb_menu_patterns'];
// Filter white-space before saving patterns.
$patterns = trim($patterns);
$patterns = preg_replace('/\\s*[\\r\\n]+\\s*/', "\n", $patterns);
// Check patterns against required syntax.
if ($patterns) {
foreach (explode("\n", $patterns) as $pattern) {
if (!preg_match(MENU_BREADCRUMB_REGEX_MATCH, $pattern)) {
$t_args = array(
'%pattern' => $pattern,
'%regex' => MENU_BREADCRUMB_REGEX_MATCH,
);
form_set_error('menu_breadcrumb_menu_patterns', t("Invalid pattern syntax: %pattern does not match %regex", $t_args));
}
}
}
}