You are here

function _custom_breadcrumbs_create_crumb in Custom Breadcrumbs 6

Same name and namespace in other branches
  1. 7 custom_breadcrumbs.module \_custom_breadcrumbs_create_crumb()

Private function for custom breadcrumb to create a crumb item

Parameters

$title: The human readable title to be rendered by the browser

$original_path: The desired URI and/or special identifier

1 call to _custom_breadcrumbs_create_crumb()
custom_breadcrumbs_nodeapi in ./custom_breadcrumbs.module

File

./custom_breadcrumbs.module, line 153
Provide custom breadcrumbs for node-type pages.

Code

function _custom_breadcrumbs_create_crumb($title, $original_path) {

  // Decode title to properly handle special characters.
  $title = decode_entities($title);

  // Collapse double slashes to one.
  $original_path = preg_replace('/\\/+/', '/', $original_path);

  // Removing leading and trailing slashes.
  $original_path = preg_replace('/^\\/|\\/+$/', '', $original_path);
  list($identifier, $path) = explode("|", $original_path, 2);
  if (isset($path) && $path !== '') {
    switch (trim($identifier)) {
      case '<pathauto>':
        if (module_exists('pathauto')) {
          module_load_include('inc', 'pathauto', 'pathauto');
          $crumb = l($title, pathauto_cleanstring($path, FALSE));
        }
        break;
      default:
        $crumb = l($title, $original_path);
    }
  }
  else {

    // This may be just be a single identifier.
    switch ($identifier) {
      case '<none>':
        $crumb = check_plain($title);
        break;
      default:
        $crumb = l($title, $original_path);
    }
  }
  return $crumb;
}