You are here

function taxonomy_facets_admin_settings_validate in Taxonomy Facets 7.3

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

Validate the configuration form.

File

./taxonomy_facets.inc, line 173
Taxo Faceted Navigation module administration screens.

Code

function taxonomy_facets_admin_settings_validate($form, &$form_state) {

  // Get first 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 can not be used as the first argument. It has already been used in the first element of the following menu path(s): <br /> @duplicate_menu_item .
       </br> Please either rename this item or go to the Clean URLs page and rename the existing item, or examine the router page to see which item is causing the problem.', array(
      '@first_arg' => $first_arg,
      '@duplicate_menu_item' => $duplicate_menu_item,
    )));
  }
  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');
  }
}