You are here

function taxonomy_menu_trails_settings_validate in Taxonomy Menu Trails 6.x

Same name and namespace in other branches
  1. 6 taxonomy_menu_trails.admin.inc \taxonomy_menu_trails_settings_validate()

Validation for settings form.

File

./taxonomy_menu_trails.admin.inc, line 81
Settings form for taxonomy_menu_trails.

Code

function taxonomy_menu_trails_settings_validate($form, &$state) {
  $patterns = preg_split('/\\R/', $state['values']['taxonomy_menu_trails_node_paths_ui'], -1, PREG_SPLIT_NO_EMPTY);
  foreach ($patterns as $pattern) {
    if (preg_match_all('/\\[title\\]|\\[nid\\]/u', $pattern, $matches) != 1) {
      form_set_error('taxonomy_menu_trails_node_paths_ui', t('Each path pattern must have one [nid] or [title] placeholder.'));
      break;
    }
  }
}