You are here

class _crumbs_BreadcrumbBuilder in Crumbs, the Breadcrumbs suite 6.2

Hierarchy

Expanded class hierarchy of _crumbs_BreadcrumbBuilder

File

./crumbs.breadcrumb.inc, line 45

View source
class _crumbs_BreadcrumbBuilder {
  protected $_pluginEngine;
  function __construct($pluginEngine) {
    $this->_pluginEngine = $pluginEngine;
  }
  function buildBreadcrumb($trail) {
    $breadcrumb = array();
    foreach ($trail as $path => $item) {
      if ($item) {
        $title = $this
          ->_findTitle($path, $item, $breadcrumb);
        if (!isset($title)) {
          $title = $item['title'];
        }

        // The item will be skipped, if $title === FALSE.
        if (isset($title) && $title !== FALSE) {
          $item['link_title'] = $title;
          $item['link_options'] = array();
          $breadcrumb[] = $item;
        }
      }
    }
    $this
      ->_decorateBreadcrumb($breadcrumb);
    return $breadcrumb;
  }
  protected function _findTitle($path, array $item, array $breadcrumb_parents) {
    $invokeAction = new _crumbs_InvokeAction_findTitle($path, $item, $breadcrumb_parents);
    $this->_pluginEngine
      ->invokeAll_find($invokeAction);
    return $invokeAction
      ->getValue();
  }
  protected function _decorateBreadcrumb(array &$breadcrumb) {
    $invokeAction = new _crumbs_InvokeAction_decorateBreadcrumb($breadcrumb);
    $this->_pluginEngine
      ->invokeAll_alter($invokeAction);
  }

}

Members