You are here

function breadcrumb_manager_is_excluded_path in Breadcrumb Manager 7

Check if the breadcrumb for the current path can be overwritten.

Parameters

string $current_path: The path to be checked.

Return value

bool Whether or not the given path is an excluded one.

1 call to breadcrumb_manager_is_excluded_path()
breadcrumb_manager_set_breadcrumb in ./breadcrumb_manager.module
Magic function: Evaluates correct breadcrumb from the given path.

File

./breadcrumb_manager.module, line 317
Code for Breadcrumb Manager module.

Code

function breadcrumb_manager_is_excluded_path($current_path = NULL) {
  if (empty($current_path)) {
    $current_path = current_path();
  }

  // Avoid breadcrumb on front page.
  $show_on_front = variable_get('breadcrumb_manager_show_front', FALSE);
  if (breadcrumb_manager_is_front_page($current_path) && !$show_on_front) {
    return TRUE;
  }
  module_load_include('inc', 'pathauto', 'pathauto');
  $paths = explode("\n", trim(variable_get('breadcrumb_manager_excluded_paths', "node\nsearch/*")));
  $current_alias = drupal_get_path_alias($current_path);
  foreach ($paths as $path) {
    $path = _pathauto_clean_separators($path, '/');
    $path = str_replace('/', '\\/', preg_quote(trim($path)));
    $path = str_replace('\\*', '.*?', $path);
    if (preg_match("/^" . $path . "\$/", $current_path) || preg_match("/^" . $path . "\$/", $current_alias)) {
      return TRUE;
    }
  }
  return FALSE;
}