You are here

function taxonomy_facets_admin_settings_validate in Taxonomy Facets 7.2

Same name and namespace in other branches
  1. 7.3 taxonomy_facets.inc \taxonomy_facets_admin_settings_validate()

Validate the configuration form.

File

./taxonomy_facets.inc, line 157
taxonomy_facets.inc Admin section of the taxo faceted navigation module

Code

function taxonomy_facets_admin_settings_validate($form, &$form_state) {

  // Get firs argument as entered by user.
  $first_arg = $form_state['values']['taxonomy_facets_first_argument'];

  // Query menu router table and see if this argument has been already used.
  $duplicate_menu_item = taxonomy_facets_firstarg_exsists_in_menu_router($first_arg);
  if ($duplicate_menu_item) {
    form_set_error('taxonomy_facets_first_argument', t('The keyword') . ' ' . $first_arg . ' ' . t('can not be used as first argument. It has already been used in the first elementh of fallowing menu path(s)') . ':<br />' . $duplicate_menu_item . '</br>' . t('Please either rename this item or go to clean urls page end rename exsisting item, or examine router page to see which item is cousing the problem.'));
  }
  else {
    global $base_url;
    $link = l(t('this page to clear the cache'), check_plain($base_url) . '/admin/config/development/performance');
    drupal_set_message(t('Value saved, please clear all caches now or you may get unexpected results. Go to: !link', array(
      '!link' => $link,
    )), 'warning');
  }
}