helper = $helper; $this->layout = $layout; } /** * @param /Hyva\Theme\ViewModel\Navigation $subject * @param $data * * @return string * @throws LocalizedException */ public function afterGetNavigation( \Hyva\Theme\ViewModel\Navigation $subject, array $dataSubject = [] ) { if ($this->helper->isEnabled() && $this->helper->getBlogConfig('display/toplinks')) { $blockMenu = $this->layout->createBlock(Menu::class); $categories = $blockMenu->getCollections(); $childData = []; foreach ($categories as $key => $category) { $data = [ "name" => $category->getName(), "id" => "mg-blog" . $category->getId(), "url" => $blockMenu->getBlogUrlByUrlKey($category->getUrlKey()), "image" => false, "has_active" => false, "is_active" => false, "is_category" => true, "is_parent_active" => true, "position" => null, "path" => $category->getPath(), "childData" => $blockMenu->getChildDataCate($category) ]; array_push($childData, $data); }; $dataSubject['mg-blog']= [ "name" => $blockMenu->getBlogHomePageTitle(), "id" => "mg-blog", "url" => $blockMenu->getBlogHomeUrl(), "image" => false, "has_active" => false, "is_active" => false, "is_category" => true, "is_parent_active" => true, "position" => null, "path" => $blockMenu->getPath(), "childData" => $childData ]; } return $dataSubject; } }