You are here

protected function crumbs_ParentFinder::_findParentPath in Crumbs, the Breadcrumbs suite 7

Same name and namespace in other branches
  1. 6.2 crumbs.trail.inc \crumbs_ParentFinder::_findParentPath()
  2. 7.2 lib/ParentFinder.php \crumbs_ParentFinder::_findParentPath()
1 call to crumbs_ParentFinder::_findParentPath()
crumbs_ParentFinder::getParentPath in lib/ParentFinder.php

File

lib/ParentFinder.php, line 40

Class

crumbs_ParentFinder
Can find a parent path for a given path. Contains a cache.

Code

protected function _findParentPath($path, &$item) {
  if ($item) {
    if (!$item['access']) {

      // Parent should be the front page.
      return FALSE;
    }
    $plugin_operation = new crumbs_PluginOperation_findParent($path, $item);
    $this->pluginEngine
      ->invokeAll_find($plugin_operation);
    $parent_path = $plugin_operation
      ->getValue();
    $this->log[$path] = $plugin_operation
      ->getLoggedCandidates();
    if (isset($parent_path)) {
      $item['crumbs_candidate_key'] = $plugin_operation
        ->getCandidateKey();
      return $parent_path;
    }
  }

  // fallback: chop off the last fragment of the system path.
  $parent_path = crumbs_reduce_path($path);
  return isset($parent_path) ? $parent_path : FALSE;
}