/** * Is current route match any child of page * * @param Page $page * @return bool */ protected function isPageSubActive(Page $page) { $current_route_name = $this->get('request')->get('_route'); if ($page->getRouteName() == $current_route_name) { return false; } $possible_child = PageQuery::create()->findOneByRouteName($current_route_name); if (!$possible_child) { return false; } if ($page->isAncestorOf($possible_child)) { return true; } else { return false; } }