You are here

function _custom_breadcrumbs_get_trail_items in Custom Breadcrumbs 7.2

Same name and namespace in other branches
  1. 6.2 custom_breadcrumbs.module \_custom_breadcrumbs_get_trail_items()

Builds the trail items for a given breadcrumb specification.

@codingStandardsIgnoreStart

Parameters

object $breadcrumb: The breadcrumb object.

array $titles: An array of titles (after token replacement).

array $paths: An array of paths (after token replacement) that may contain special identifiers.

Return value

array An associative array of trail items with keys 'title' - the title of the item 'href' - the path of the item used to set the active trail 'crumb'- the html crumb for use in the breadcrumb

1 call to _custom_breadcrumbs_get_trail_items()
_custom_breadcrumbs_get_breadcrumb in ./custom_breadcrumbs.module
Gets the custom breadcrumb.

File

./custom_breadcrumbs.module, line 484
Main file for the Custom breadcrumbs.

Code

function _custom_breadcrumbs_get_trail_items($breadcrumb, $titles, $paths) {

  // @codingStandardsIgnoreEnd
  $trail_items = array();
  for ($i = 0; $i < count($titles); $i++) {
    $title = trim($titles[$i]);
    if ($title != '' && $title != '<none>') {

      // Create a breadcrumb only if there is a title.
      // Include optional html attributes.
      $options = _custom_breadcrumbs_identifiers_option($i + 1, $breadcrumb->bid);
      $crumb_items = _custom_breadcrumbs_create_crumb_items($title, trim($paths[$i]), $options);
      $trail_items = array_merge($trail_items, $crumb_items);
    }
  }
  return $trail_items;
}