Defines global template's layout

@param string $layout Template name
@param string $layoutModule Just a basename of that layout inside theme's folder
@return \Krystal\Application\View\ViewManager
969211
public function setLayout($layout, $layoutModule = null)
    {
        $this->layout = $layout;
        $this->layoutModule = $layoutModule;

        return $this;
    }
178771
public function layout($layout, $params = [])
    {
        $this->layout = $layout;
        $this->params = $params;
        return $this;
    }
24096
public function setModule($module)
    {
        $layout = $this->getViewModel();
        $layout->setModule((string) $module);

        return $this;
    }
949559
protected function getLayoutFile(Layout $layout)
    {
        $layoutfile = $layout->getPath();
        if (null === $layoutfile && 0 < count($this->_includeExtensions)) {
            $ext = reset($this->_includeExtensions);
            $layoutfile = StringUtils::toPath($layout->getLabel(), array('extension' => $ext));
            $layout->setPath($layoutfile);
        }

        return $layoutfile;
    }
778777
public function setLayout( $template )
	{
		$template = str_replace( get_stylesheet_directory().'/templates/', '', $template );
		$this->template = UtilityFacade::trimRight( $template, '.php' );
		return $this->get( apply_filters( 'castor/templates/layout', 'layouts/default' ));
	}
1219084
public function getModuleLayoutViewPath()
    {
        if ($this->module->useAppViewPath) {
            return '@app/views/'.$this->module->id.'/';
        }
        
        return '@'.$this->module->id.'/views/';
    }
1373754
protected static function compileWith(array $layoutTplVars)
    {
        if (static::$filename === null) {
            throw new \Exception('Layout template file name does not set: use Layout::setFilename().');
        }

        $tpl       = new PhpTemplate(VIEWS . static::$filename);
        $tpl->vars = $layoutTplVars;

        $compiledHtml = $tpl->compile();
        foreach ($layoutTplVars as $key => $value) {
            $compiledHtml = str_replace('{' . $key . '}', $value, $compiledHtml);
        }

        return $compiledHtml;
    }
29664
public function newLayoutUpdateStruct(?Layout $layout = null): LayoutUpdateStruct
    {
        $layoutUpdateStruct = new LayoutUpdateStruct();

        if (!$layout instanceof Layout) {
            return $layoutUpdateStruct;
        }

        $layoutUpdateStruct->name = $layout->getName();
        $layoutUpdateStruct->description = $layout->getDescription();

        return $layoutUpdateStruct;
    }
1205526
private function renderPage($layoutFile = null, $params = null)
    {
        $this->setNode($this->getObject());

        $application = $this->getApplication();
        // Rendering subcontent
        if (null !== $contentSet = $this->getObject()->getContentSet()) {
            $bbUserToken = $application->getBBUserToken();
            $revisionRepo = $application->getEntityManager()->getRepository('BackBee\ClassContent\Revision');
            if (null !== $bbUserToken && null !== $revision = $revisionRepo->getDraft($contentSet, $bbUserToken)) {
                $contentSet->setDraft($revision);
            }

            $layout = $this->getObject()->getLayout();
            $zones = $layout->getZones();
            $zoneIndex = 0;

            foreach ($contentSet->getData() as $content) {
                if (array_key_exists($zoneIndex, $zones)) {
                    $zone = $zones[$zoneIndex];
                    $isMain = null !== $zone && property_exists($zone, 'mainZone') && true === $zone->mainZone;
                    $this->container()->add($this->render($content, $this->getMode(), array(
                        'class' => 'rootContentSet',
                        'isRoot' => true,
                        'indexZone' => $zoneIndex++,
                        'isMainZone' => $isMain,
                    ), null, $this->_ignoreIfRenderModeNotAvailable));
                }
            }
        }

        // Check for a valid layout file
        $this->templateFile = $layoutFile;
        if (null === $this->templateFile) {
            $this->templateFile = $this->getLayoutFile($this->getCurrentPage()->getLayout());
        }

        if (!$this->isValidTemplateFile($this->templateFile, true)) {
            throw new RendererException(
                sprintf('Unable to read layout %s.', $this->templateFile), RendererException::LAYOUT_ERROR
            );
        }

        $application->info(sprintf('Rendering page `%s`.', $this->getObject()->getNormalizeUri()));

        return $this->renderTemplate(false, true);
    }
172652
protected function extends($layout)
    {
        if ($this->extends !== false) {
            throw new Templating_Exception($this->current_view . ' is attempting to extend multiple layouts.');
        }
        $this->extends = $this->get_template_name($layout);
    }
1100387
private function addTranslations(Layout $layout, array $layoutData): void
    {
        $translationLocales = $this->extractTranslationLocales($layoutData);

        foreach ($translationLocales as $locale) {
            $this->layoutService->addTranslation($layout, $locale, $layoutData['main_locale']);
        }
    }
1030180
public function render(string $layout = null, array $context = [])
    {
        if (null === $layout) {
            $layout = 'default';
        }

        $grav = Grav::instance();

        $block = HtmlBlock::create();
        $block->disableCache();

        $output = $this->getTemplate($layout)->render(
            ['grav' => $grav, 'config' => $grav['config'], 'block' => $block, 'form' => $this, 'layout' => $layout] + $context
        );

        $block->setContent($output);

        return $block;
    }
452428
public function addItemAction(Request $request, Layout $layout)
    {
        $this->guard($layout, 'update');

        $region = $this->validateInputAndGetRegionName($request);

        $nid = $request->get('nid');
        if (empty($nid)) {
            throw $this->createNotFoundException();
        }
        if (!$node = $this->getNodeStorage()->load($nid)) {
            throw $this->createNotFoundException();
        }
        if (!$node->access('view')) {
            throw $this->createAccessDeniedException();
        }

        $viewmode = $request->get('view_mode', 'teaser');
        $position = $request->get('position');
        $manager  = $this->getContextManager();
        $site     = $this->getSiteContext();
        $item     = new Item($nid, $viewmode);
        $region   = $layout->getRegion($region);

        $region->addAt($item, $position);

        if ($manager->isPageContextRegion($region->getName(), $site->theme)) {
            $manager->getPageContext()->getStorage()->save($layout);
        } else if ($manager->isTransversalContextRegion($region->getName(), $site->theme)) {
            $manager->getSiteContext()->getStorage()->save($layout);
        } else {
            throw $this->createAccessDeniedException();
        }

        return new JsonResponse(['success' => true, 'output' => $this->renderNode($node, $region, $viewmode)]);
    }
957151
public function viewMake($layout, $data = array())
    {
        $data = Arr::merge($data, array('body' => array(
            'attributes' => array('class' => static::$tplPrefixClass.str_replace(array('::', '.'), '-', $layout))
        )));

        $data = $this->getCommonVars($data);

        return View::make($layout, $data);
    }
673042
protected function initializeLayout(FieldsBuilder $layout, $args = [])
    {
        $layout->setGroupConfig('name', $layout->getName());
        $layout->setGroupConfig('display', 'block');

        foreach ($args as $key => $value) {
            $layout->setGroupConfig($key, $value);
        }

        $layout->setParentContext($this);

        return $layout;
    }
404867
private function setCacheCompiler($f, $layout=false)
	{
        $viewCompiler = new viewCompiler($this);
        $viewCompiler->content = file_get_contents($f);

		if($layout === true) {
			return $viewCompiler->runCompiler([
				'renderCompiler',
				'startLayoutSectionCompiler',
				'echoCompiler'
			]);
		} else {
			return $viewCompiler->runCompiler(['startLayoutSectionCompiler'], true);
		}
	}
864593
public function setLayout($template) {
		$layout = $this->getTemplatePathname($template);
		if(!is_file($layout)) {
			throw new \RuntimeException("Layout file `$template` does not exist.");
		} else {
			$this->layout = $template;
		}
	}