public function addChild(NavigationItem $oChild) { $this->prepareChildren(); $oChild->oParent = $this; $this->aCustomChildren[$oChild->getName()] = $oChild; }
/** * Compares this item with another one, but doesn't check the children * @param NavigationItem $other The other NavigationItem of the comparison * @return bool True if the NavigationItems are equal, otherwise false */ public function equalsChildless(NavigationItem $other) { return $this->getName() == $other->getName(); }
/** * @param int $iLevel level of current NavigationItem (expensive to calculate from the NavigationItem alone) * @param BooleanParser $oBooleanParser the BooleanParser instance holding information about the current NavigationItem’s properties] * @param NavigationItem $oNavigationItem the current navigation item * @return string parsed navigation */ private function getConfigForPage($iLevel, $oBooleanParser, $oNavigationItem) { $aConfigToCheck = @$this->aConfig[$iLevel]; if ($aConfigToCheck === null) { if (!isset($this->aConfig['all'])) { return null; } $aConfigToCheck = $this->aConfig['all']; } foreach ($aConfigToCheck as $aConfig) { if (isset($aConfig['page_name']) && $aConfig['page_name'] !== $oNavigationItem->getName()) { continue; } if (isset($aConfig['page_identifier']) && $aConfig['page_identifier'] !== $oNavigationItem->getIdentifier()) { continue; } if (isset($aConfig['page_type']) && $aConfig['page_type'] !== $oNavigationItem->getType()) { continue; } if (!isset($aConfig['on']) || $oBooleanParser->parse($aConfig['on'])) { return $aConfig; } } return null; }