Return the file path to current layout, try to create it if not exists.

@param Layout $layout

@return string the file path

@throws RendererException
193511
protected function getLayoutFile(Layout $layout)
    {
        $layoutfile = $layout->getPath();
        if (null === $layoutfile && 0 < $this->manageableExt->count()) {
            $adapter = null;
            if (null !== $this->defaultAdapter && null !== $adapter = $this->rendererAdapters->get($this->defaultAdapter)) {
                $extensions = $adapter->getManagedFileExtensions();
            } else {
                $extensions = $this->manageableExt->keys();
            }

            if (0 === count($extensions)) {
                throw new RendererException(
                        'Declared adapter(s) (count:'.$this->rendererAdapters->count().') is/are not able to manage '.
                        'any file extensions at moment.'
                );
            }

            $layoutfile = StringUtils::toPath($layout->getLabel(), array('extension' => reset($extensions)));
            $layout->setPath($layoutfile);
        }

        return $layoutfile;
    }
760952
public function hasLayout($layout)
    {
        $extensions = ['.php', '.phtml', '.html', '.tpl'];

        if (isset($this->presets[ 'extensions' ])) {
            array_unshift($partialsExtensions, $this->presets[ 'extension' ]);
        } elseif (isset($this->presets[ 'extension' ])) {
            array_unshift($extensions, $this->presets[ 'extension' ]);
        }

        $found = false;
        foreach ($extensions as $extension) {
            $extension = trim($extension, '.');

            if ($layout === 'theme') {
                $layoutFilePath = $this->getRealPath() . 'theme.' . $extension;
            } else {
                $layoutFilePath = $this->getRealPath() . 'layouts' . DIRECTORY_SEPARATOR . dash($layout) . DIRECTORY_SEPARATOR . 'layout.' . $extension;
            }

            if (is_file($layoutFilePath)) {
                $found = true;
                break;
            }
        }

        return (bool) $found;
    }
576699
public function getLayoutPath()
    {
        $ref = new \ReflectionClass($this);
        return dirname(dirname($ref->getFileName())) . '/views/layouts/' . $this->layout . '.php';
    }
646723
protected function CanDelete(Layout $layout)
    {
        return self::Guard()->Allow(BackendAction::Delete(), $layout)
            && self::Guard()->Allow(BackendAction::UseIt(), new LayoutForm());
    }
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);
		}
	}
1246799
public function getLayout()
    {
        if (is_null($this->_layout)) {
            $default = 'layouts/default';
            $ext = $this->_routeInfo->getExtension();
            $file = "{$default}.{$ext}.twig";
            if (!is_null($this->_controller->layout)) {
                $file = "{$this->_controller->layout}.{$ext}.twig";
            }
            $this->_layout = new View(['file' => $file]);
        }
        return $this->_layout;
    }
996069
public function renderLayout($content, $layout = null)
    {
        $html = parent::renderLayout($content, $layout);

        return $this->shortcodes($html);
    }
212728
public function renderContent($layout = null, $title = null)
    {
        if ($this->hasSourceComponent()) {
            return $this->SourceComponent()->renderContent($layout, $title);
        }
        
        return parent::renderContent($layout, $title);
    }
1313915
public function layoutPath($layoutPath = false)
    {
        if ($layoutPath === false) {
            return $this->_layoutPath;
        }

        $this->_layoutPath = $layoutPath;

        return $this;
    }
184398
public function renderSelf($layout = null, $title = null)
    {
        if ($this->hasSourceComponent()) {
            
            $source = $this->SourceComponent();
            
            if ($this->StyleID) {
                $source->StyleID = $this->StyleID;
            }
            
            $source->loadRequirements();
            
        }
        
        return parent::renderSelf($layout, $title);
    }
900268
static function LayoutTemplate(Layout $layout)
    {
        $folder = Path::Combine(PHINE_PATH, 'App/Phine/LayoutTemplates');
        $file = Path::Combine($folder, $layout->GetName());
        return Path::AddExtension($file, 'phtml');
    }
1289
public function renderContainer($layout = null, $title = null)
    {
        return sprintf(
            "<div class=\"%s\">\n%s</div>\n",
            $this->getContainerClass(),
            $this->renderChildren($layout, $title)
        );
    }
1165243
public function render()
	{
		// Get the layout path.
		$path = $this->getPath($this->getLayout());

		// Check if the layout path was found.
		if (!$path)
		{
			throw new \RuntimeException('Layout Path Not Found');
		}

		// Start an output buffer.
		ob_start();

		// Load the layout.
		include $path;

		// Get the layout contents.
		$output = ob_get_clean();

		return $output;
	}
438941
public function renderPage($view, $layout = null)
    {
        $event = new PageMenuContextualEvent($view);

        //Set currentView and dispatch victoire.on_render_page event with this currentView
        $pageRenderEvent = new PageRenderEvent($view);
        $this->eventDispatcher->dispatch('victoire.on_render_page', $pageRenderEvent);
        $this->currentViewHelper->setCurrentView($view);

        //Build WidgetMap
        $this->widgetMapBuilder->build($view, true);

        //Populate widgets with their data
        $this->widgetDataWarmer->warm($this->entityManager, $view);

        //Dispatch contextual event regarding page type
        if (in_array($view->getType(), ['business_page', 'virtual_business_page'])) {
            //Dispatch also an event with the Business entity name
            $eventName = 'victoire_core.page_menu.contextual';
            if (!$view->getId()) {
                $eventName = 'victoire_core.business_template_menu.contextual';
                $event = new PageMenuContextualEvent($view->getTemplate());
            }
            $this->eventDispatcher->dispatch($eventName, $event);
            $type = $view->getBusinessEntityId();
        } else {
            $type = $view->getType();
        }

        $eventName = 'victoire_core.'.$type.'_menu.contextual';
        $this->eventDispatcher->dispatch($eventName, $event);

        if (null === $layout) {
            //Determine which layout to use
            $layout = $this->guessBestLayoutForView($view);
        }
        $globalConfig = $this->entityManager->getRepository(GlobalConfig::class)->findLast() ?: new GlobalConfig();

        //Create the response
        $response = $this->container->get('templating')->renderResponse('VictoireCoreBundle:Layout:'.$layout.'.html.twig', [
            'globalConfig'                    => $globalConfig,
            'victoire_i18n_available_locales' => $this->availableLocales,
            'victoire_twig_responsive'        => $this->twigResponsive,
            'view'                            => $view,
        ]);

        return $response;
    }
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;
    }
536701
protected function questions_recode_layout($layout) {
        // Extracts question id from sequence
        if ($questionids = explode(',', $layout)) {
            foreach ($questionids as $id => $questionid) {
                if ($questionid) { // If it is zero then this is a pagebreak, don't translate
                    $newquestionid = $this->get_mappingid('question', $questionid);
                    $questionids[$id] = $newquestionid;
                }
            }
        }
        return implode(',', $questionids);
    }
1064515
static function LastLayoutLog(Layout $layout)
    {
        $tblLogLayout = LogLayout::Schema()->Table();
        $tblLogItem = LogItem::Schema()->Table();
        $sql = Access::SqlBuilder();
        $orderBy = $sql->OrderList($sql->OrderDesc($tblLogItem->Field('Changed')));
        $joinCond = $sql->Equals($tblLogLayout->Field('LogItem'), $tblLogItem->Field('ID'));
        $where = $sql->Equals($tblLogLayout->Field('Layout'), $sql->Value($layout->GetID()));
        return LogItem::Schema()->First($where, $orderBy, null, $sql->Join($tblLogLayout), JoinType::Inner(), $joinCond);
    }