/** * Get a page layout and return it as database result object * @param \Model * @return \Model */ public static function getPageLayout($objPage) { if ($objPage == NULL) { return false; } $object = new self(); $blnMobile = $objPage->mobileLayout && \Environment::get('agent')->mobile; // Override the autodetected value if (\Input::cookie('TL_VIEW') == 'mobile' && $objPage->mobileLayout) { $blnMobile = true; } elseif (\Input::cookie('TL_VIEW') == 'desktop') { $blnMobile = false; } $intId = $blnMobile ? $objPage->mobileLayout : $objPage->layout; $objLayout = \LayoutModel::findByPk($intId); // Die if there is no layout if ($objLayout === null) { $objLayout = false; if ($objPage->pid > 0) { $objParentPage = $object->getParentPage($objPage->pid); $objLayout = $object->getPageLayout($objParentPage); } } return $objLayout; }