/** * Returns the target page for a page with internal target * @todo use this everywhere (resolver!) * @param \Cx\Core\ContentManager\Model\Entity\Page $page */ public function getTargetPage($page) { if (!$page->isTargetInternal()) { throw new PageRepositoryException('Tried to get target node, but page has no internal target'); } // TODO: basically the method \Cx\Core\ContentManager\Model\Entity\Page::cutTarget() would provide us a ready to use $crit array // Check if we could directly use the array from cutTarget() and implement a public method to cutTarget() $nodeId = $page->getTargetNodeId(); $module = $page->getTargetModule(); $cmd = $page->getTargetCmd(); $langId = $page->getTargetLangId(); if ($langId == 0) { $langId = FRONTEND_LANG_ID; } $page = $this->findOneByModuleCmdLang($module, $cmd, $langId); if (!$page) { $page = $this->findOneByModuleCmdLang($module, $cmd . '_' . $langId, FRONTEND_LANG_ID); } if (!$page) { $page = $this->findOneByModuleCmdLang($module, $langId, FRONTEND_LANG_ID); } if (!$page) { $page = $this->findOneBy(array('nodeIdShadowed' => $nodeId, 'lang' => $langId)); } return $page; }
public function getTargetLangId() { $this->_load(); return parent::getTargetLangId(); }