protected function getPages(UriInterface $uri, $start, $stop, $currentPage) { $pages = new ViewDataCollection(); for ($i = $start; $i <= $stop; $i++) { $url = $this->getPageUrl($uri, $i); if ($currentPage == $i) { $url->selected = true; } $pages->add($url); } return $pages; }
protected function addToCollection($categoryId, ViewDataCollection $collection, $ancestors, $categoryTree) { if (!empty($ancestors)) { $firstAncestor = array_shift($ancestors); $firstAncestorEntry = $categoryTree[$firstAncestor]; $firstAncestorEntry->selected = true; foreach ($firstAncestorEntry->children as $id => $entry) { if ($id != $categoryId && !in_array($id, $ancestors)) { unset($entry->children); } } $collection->add($firstAncestorEntry, $firstAncestor); $this->addToCollection($categoryId, $firstAncestorEntry->children, $ancestors, $categoryTree); } else { $categoryEntry = $categoryTree[$categoryId]; $categoryEntry->selected = true; if (isset($categoryEntry->children)) { foreach ($categoryEntry->children as $entry) { unset($entry->children); } } $collection->add($categoryEntry, $categoryId); } }
public function addNode(Url $url) { $this->children->add($url); }