/** * Get the array of slugs of the parents. * * @param WebViewInterface $view * @param string[] $slugs * * @return string[] */ protected function getParentSlugs(WebViewInterface $view, array $slugs) { $parent = $view->getParent(); if ($parent !== null) { if (!(method_exists($parent, 'isHomepage') && $parent->isHomepage())) { array_push($slugs, $parent->getSlug()); } if ($parent->getParent() !== null) { $slugs = $this->getParentSlugs($parent, $slugs); } } return array_unique($slugs); }
/** * Get the array of slugs of the parents * @param WebViewInterface $view * @param array $slugs * * @return array */ protected function getParentSlugs(WebViewInterface $view, array $slugs) { $parent = $view->getParent(); if ($parent !== null) { array_push($slugs, $parent->getSlug()); if ($parent->getParent() !== null) { $slugs = array_merge($slugs, $this->getParentSlugs($parent, $slugs)); } } return array_unique($slugs); }