You are here

function _custom_breadcrumbs_paths_get_breadcrumbs in Custom Breadcrumbs 6.2

Same name and namespace in other branches
  1. 7.2 custom_breadcrumbs_paths/custom_breadcrumbs_paths.module \_custom_breadcrumbs_paths_get_breadcrumbs()

Gets the custom_breadcrumbs_paths breadcrumbs.

Parameters

$matchpath: If TRUE, then load all paths breadcrumbs to allow wildcard matching, otherwise only the current path is queried.

$path: The drupal path to match against.

Return value

$breadcrumbs An array of breadcrumb objects meeting the query criteria.

1 call to _custom_breadcrumbs_paths_get_breadcrumbs()
_custom_breadcrumbs_paths_set_breadcrumb in custom_breadcrumbs_paths/custom_breadcrumbs_paths.module
Checks for a custom breadcrumb at the current path and sets it if one is found.

File

custom_breadcrumbs_paths/custom_breadcrumbs_paths.module, line 178

Code

function _custom_breadcrumbs_paths_get_breadcrumbs($matchpath = FALSE, $path = NULL) {

  // Don't bother checking if we don't have a path to match against.
  if (isset($_REQUEST['q']) || !is_null($path)) {
    global $language;
    $languages = array(
      'language' => $language->language,
      'all' => '',
    );

    // Load all path breadcrumbs for wildcard matching.
    $param = array();
    if (!$matchpath) {

      // Check for path prefix and strip it out if its found.
      $prefix = $language->prefix . '\\/';
      $path = is_null($path) ? preg_replace('/^' . $prefix . '/', '', $_REQUEST['q']) : $path;
      $param = array(
        'specific_path' => $path,
      );
    }
    $breadcrumbs = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs_paths', NULL, $param, $languages);
    return $breadcrumbs;
  }
}