예제 #1
0
파일: LayoutManager.php 프로젝트: reliv/rcm
 /**
  * Get Layout method will attempt to locate and fetch the correct layout
  * for the site and page.  If found it will pass back the path to correct
  * view template so that the indexAction can pass that value on to the
  * renderer.
  *
  * @param string|null $layout Layout to find
  * @param Site        $site   Site to lookup
  *
  * @return string
  * @throws RuntimeException
  * @throws InvalidArgumentException
  */
 public function getSiteLayout(Site $site, $layout = null)
 {
     $themeLayoutConfig = $this->getSiteThemeLayoutsConfig($site->getTheme());
     if (empty($layout)) {
         $layout = $site->getSiteLayout();
     }
     if (!empty($themeLayoutConfig[$layout]) && !empty($themeLayoutConfig[$layout]['file'])) {
         return $themeLayoutConfig[$layout]['file'];
     } elseif (!empty($themeLayoutConfig['default']) && !empty($themeLayoutConfig['default']['file'])) {
         return $themeLayoutConfig['default']['file'];
     }
     throw new RuntimeException('No Layouts Found in config');
 }