You are here

function taxonomy_facets_firstarg_exsists_in_menu_router in Taxonomy Facets 7.3

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

Check the menu_router, url_alias table and see if the keyword exsits.

1 call to taxonomy_facets_firstarg_exsists_in_menu_router()
taxonomy_facets_admin_settings_validate in ./taxonomy_facets.inc
Validate the configuration form.

File

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

Code

function taxonomy_facets_firstarg_exsists_in_menu_router($first_arg) {
  $duplicate_path = NULL;

  // Check the menu_router table.
  $query = db_select('menu_router', 'mr');
  $or = db_or()
    ->condition('mr.path', $first_arg . '/%', 'LIKE')
    ->condition('mr.path', $first_arg);
  $query
    ->condition($or)
    ->fields('mr', array(
    'path',
    'page_callback',
  ))
    ->range(0, 50);
  $result = $query
    ->execute();
  foreach ($result as $row) {

    // If path produced by this module ignore.
    if ($row->page_callback != 'taxonomy_facets_print_landing_page') {
      $duplicate_path .= $row->path . '<br />';
    }
  }

  // Check url_alias table, alias field.
  $query = db_select('url_alias', 'ua');
  $or = db_or()
    ->condition('ua.alias', $first_arg . '/%', 'LIKE')
    ->condition('ua.alias', $first_arg);
  $query
    ->condition($or)
    ->fields('ua', array(
    'alias',
  ))
    ->range(0, 50);
  $result = $query
    ->execute();
  foreach ($result as $row) {
    $duplicate_path .= $row->alias . '<br />';
  }

  // Check url_alias table, source field.
  $query = db_select('url_alias', 'ua');
  $or = db_or()
    ->condition('ua.source', $first_arg . '/%', 'LIKE')
    ->condition('ua.source', $first_arg);
  $query
    ->condition($or)
    ->fields('ua', array(
    'source',
  ))
    ->range(0, 50);
  $result = $query
    ->execute();
  foreach ($result as $row) {
    $duplicate_path .= $row->source . '<br />';
  }
  return $duplicate_path;
}