/** * @param string $path * @param array &$item * * @return string|bool */ protected function _findParentPath($path, &$item) { if ($item) { if (!$item['access']) { // Parent should be the front page. return FALSE; } $parent_path = $this->pluginEngine->findParent($path, $item); if (isset($parent_path)) { return $parent_path; } } // fallback: chop off the last fragment of the system path. $parent_path = $this->router->reducePath($path); return isset($parent_path) ? $parent_path : FALSE; }
/** * @param array $trail * @return array */ function buildBreadcrumb($trail) { $breadcrumb = array(); foreach ($trail as $path => $item) { if ($item) { $title = $this->pluginEngine->findTitle($path, $item, $breadcrumb); if (!isset($title)) { $title = $item['title']; } // The item will be skipped, if $title === FALSE. if (isset($title) && $title !== FALSE && $title !== '') { $item['title'] = $title; $breadcrumb[] = $item; } } } return $breadcrumb; }
/** * @param crumbs_PluginSystem_PluginEngine $unfilteredPluginEngine * * @return array */ private function getAllCandidates($unfilteredPluginEngine) { $candidates_all = array('parent' => array(), 'title' => array()); $candidateKeys = array(); $breadcrumb = array(); foreach ($this->paths as $i => $path) { $candidates = $unfilteredPluginEngine->findAllTitles($path, $this->trail[$path], $breadcrumb); $candidates_all['title'][$i] = $candidates; foreach ($candidates as $candidateKey => $candidate) { $candidateKeys[$candidateKey] = TRUE; } if ($i + 1 < count($this->trail)) { $candidates = $unfilteredPluginEngine->findAllParents($path, $this->trail[$path]); $candidates_all['parent'][$i] = $candidates; foreach ($candidates as $candidateKey => $candidate) { $candidateKeys[$candidateKey] = TRUE; } } } return array($candidates_all, $candidateKeys); }