/** * Return the correct linking mode, for use in menus */ public function LinkingMode() { $listingClass = $this->stat('listing_page_class'); //Check that we have a controller to work with and that it is a listing page if (($controller = Controller::Curr()) && Controller::curr() instanceof $listingClass) { //check that the action is 'show' and that we have an item to work with if ($controller->getAction() == 'show' && ($item = $controller->getCurrentItem())) { return $item->ID == $this->ID ? 'current' : 'link'; } } }