You are here

function _hansel_set_test_path in Hansel breadcrumbs 7

Same name and namespace in other branches
  1. 8 hansel.module \_hansel_set_test_path()

Set the test path for Hansel, used on the test tab.

@access private

Parameters

string $path:

1 call to _hansel_set_test_path()
hansel_ui_test_form in hansel_ui/hansel_ui.test.inc
Menu callback to generate the Hansel test form.

File

./hansel.module, line 335
Hansel module

Code

function _hansel_set_test_path($path) {
  global $_hansel_test_path;

  // The arg() output - which we use to switch on - is always the real path, not the alias.
  if (empty($path)) {
    $path = variable_get('site_frontpage', 'node');
    drupal_set_message(t('Path %path is used as frontpage', array(
      '%path' => $path,
    )));
  }
  if (module_exists('path')) {
    $res = db_query("SELECT source FROM {url_alias} WHERE alias = :path", array(
      ':path' => $path,
    ));
    if ($src = $res
      ->fetchField()) {
      drupal_set_message(t('Given path is an alias, using %src instead', array(
        '%src' => $src,
      )), 'warning');
      $path = $src;
    }
  }
  $_hansel_test_path = $path;
}