/** * @param int|null $layoutParagraphId * @return \Zork\Mvc\Controller\Plugin\MiddleLayout|boolean */ public function findMiddleParagraphLayoutById($layoutParagraphId = null) { $layoutRenderList = null; if (!empty($layoutParagraphId)) { $layoutRenderList = $this->paragraphModel->findRenderList($layoutParagraphId); if (!empty($layoutRenderList)) { @(list($_, $root) = reset($layoutRenderList)); if (empty($root) || 'layout' !== $root->type) { $layoutRenderList = null; } } } if (empty($layoutRenderList)) { $layoutRenderList = $this->paragraphModel->findRenderList($this->subDomainModel->findActual()->defaultLayoutId); } if (!empty($layoutRenderList)) { $auth = $this->getAuthenticationService(); if ($auth->hasIdentity()) { $adminMenuSettings = $this->userSettingsModel->find($auth->getIdentity()->id, 'adminMenu'); } else { $adminMenuSettings = null; } $template = new MiddleLayout(array('template' => 'grid/paragraph/render/paragraph', 'variables' => array('paragraphRenderList' => $layoutRenderList, 'adminMenuSettings' => $adminMenuSettings))); return $template; } else { return false; } }