Render the HTML of the content.

@param string $layout

@return array
543944
public function renderContent($layout)
    {
        $tmp = ' '; // void in case of not yet content

        if (isset($layout['content']) && isset($layout['type']) && is_array($layout['content'])) {
            foreach ($layout['content'] as $content) {
                $tmp .= $this->render(
                    'ClarolineCoreBundle:home/types:'.$content['type'].'.html.twig', $content, true
                )->getContent();
            }
        }

        $layout['content'] = $tmp;

        return $layout;
    }
288063
public function viewContent($layout, $data = array())
    {
        $data = array_merge($data, array('body' => array(
            'attributes' => array('class' => static::$tplPrefixClass.str_replace('::', '-', $layout))
        )));

        return $this->layout->content = View::make($layout, $this->getCommonVars($data));
    }
893693
public function getView(Layout $layout)
    {
        $identifier = $layout->getTemplateFile();

        if (null === $this->view[$identifier]) {
            $this->view[$identifier] = $this->getViewInstance($layout);
        }

        return clone $this->view[$identifier];
    }
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;
    }
950470
public function updateLayout(Layout $layout)
    {
        if (null === $layout->getSite()) {
            return false;
        }

        $layoutfile = $this->getLayoutFile($layout);
        File::resolveFilepath($layoutfile, null, array('include_path' => $this->_layoutdir));

        if (false === file_exists($layoutfile)) {
            File::resolveFilepath($layoutfile, null, array('base_dir' => $this->_layoutdir[1]));
        }

        if (false === file_exists($layoutfile) && false === touch($layoutfile)) {
            throw new RendererException(sprintf('Unable to create file %s.', $layoutfile), RendererException::LAYOUT_ERROR);
        }

        if (!is_writable($layoutfile)) {
            throw new RendererException(sprintf('Unable to open file %s in writing mode.', $layoutfile), RendererException::LAYOUT_ERROR);
        }

        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;
    }
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);
    }
717037
protected function renderUsage(BlockLayout $layout, Command $command)
    {
        $formatsToPrint = array();

        // Start with the default commands
        if ($command->hasDefaultSubCommands()) {
            // If the command has default commands, print them
            foreach ($command->getDefaultSubCommands() as $subCommand) {
                // The name of the sub command is only optional (i.e. printed
                // wrapped in brackets: "[sub]") if the command is not
                // anonymous
                $nameOptional = !$subCommand->getConfig()->isAnonymous();

                $formatsToPrint[] = array($subCommand->getArgsFormat(), $nameOptional);
            }
        } else {
            // Otherwise print the command's usage itself
            $formatsToPrint[] = array($command->getArgsFormat(), false);
        }

        // Add remaining sub-commands
        foreach ($command->getSubCommands() as $subCommand) {
            // Don't duplicate default commands
            if (!$subCommand->getConfig()->isDefault()) {
                $formatsToPrint[$subCommand->getName()] = array($subCommand->getArgsFormat(), false);
            }
        }

        $appName = $command->getApplication()->getConfig()->getName();
        $prefix = count($formatsToPrint) > 1 ? '    ' : '';

        $layout->add(new Paragraph('<b>USAGE</b>'));
        $layout->beginBlock();

        foreach ($formatsToPrint as $vars) {
            $this->renderSynopsis($layout, $vars[0], $appName, $prefix, $vars[1]);
            $prefix = 'or: ';
        }

        if ($command->hasAliases()) {
            $layout->add(new EmptyLine());
            $this->renderAliases($layout, $command->getAliases());
        }

        $layout->endBlock();
        $layout->add(new EmptyLine());
    }
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;
    }
1211222
def layout_render(content)
			return content unless @layout

			layout_files = find_layouts(@layout)
			return content if layout_files.empty?

			layout_files.each_with_object(content.dup) do |layout_file, result|
				layout = compile_file(layout_file)
				result.replace layout.render(@scope, @locals) { result }
			end
		end
1273607
public function getLayoutPath($module, $layout = 'default')
	{
		$template = $this->app['template']->template;
		$path     = dirname($this->app['template']->path);
		$default  = $layout;

		if (strpos($layout, ':') !== false)
		{
			// Get the template and file name from the string
			$temp = explode(':', $layout);

			$template = ($temp[0] == '_') ? $template : $temp[0];
			$layout   = $temp[1];
			$default  = ($temp[1]) ? $temp[1] : 'default';
		}

		// Build the template and base path for the layout
		$tPath = $path . '/' . $template . '/html/' . $module . '/' . $layout . '.php';

		$base = dirname($this->path($module));

		$bPath = $base . '/tmpl/' . $default . '.php';
		$dPath = $base . '/tmpl/default.php';

		// If the template has a layout override use it
		if (file_exists($tPath))
		{
			return $tPath;
		}
		elseif (file_exists($bPath))
		{
			return $bPath;
		}

		return $dPath;
	}
774411
public function generateLayout($layout)
    {
        $layout = Inflector::toDirectorySeparator($layout);

        $file = $this->getViewTemplatePath().$layout.DS.$this->viewLayoutName();
        $appViewPath = '';
        $appViewPath = $this->command->applicationDir.DS.'Views'.DS;

        $this->hasDirectory($appViewPath);
        $this->hasDirectory($appViewPath.'layouts');
        $this->hasDirectory($appViewPath.DS.$layout);

        file_exists($file) or die("Base layout stub file doesn't exists in Cygnite Core");

        $layoutFile = $appViewPath.$layout.DS.$this->viewLayoutName();

        if ($this->layoutType == 'php') {
            $layoutFile = str_replace('.stub', EXT, $layoutFile);
        } else {
            $layoutFile = str_replace('.stub', '.twig', $layoutFile);
        }

        if (file_exists($layoutFile)) {
            echo "\n Layout file already exists in $layoutFile directory \n";

            return true;
        }

        /*read operation ->*/
        // Open the file to get existing content
        $fileContent = file_get_contents($file);

        $handle = null;

        $handle = fopen($layoutFile, 'w') or die('Cannot open file:  '.$layoutFile);

        fwrite($handle, $fileContent);
        fclose($handle);
    }
374687
private function transformLayout($layout)
    {
        $layoutTransform = new Transform\FlexibleContentLayout($this);
        $namespaceTransform = new Transform\NamespaceFieldKey($this);

        return
            $namespaceTransform->transform(
                $layoutTransform->transform($layout)
            );
    }
812582
protected function renderDescription(BlockLayout $layout, $help)
    {
        $layout
            ->add(new Paragraph('<b>DESCRIPTION</b>'))
            ->beginBlock()
                ->add(new Paragraph($help))
            ->endBlock()
            ->add(new EmptyLine())
        ;
    }
487619
public function renderPartial($view)
    {
        $lay = $this->layout;
        $wi = $this->view;

        $this->layout = null;
        $this->view = $view;
        $output = $this->render();
        $this->layout = $lay;
        $this->view = $wi;

        return $output;
    }
1156667
public function template($template = false, $layout = false)
    {
        deprecationWarning(
            'Email::template() is deprecated. ' .
            'Use $email->viewBuilder()->getTemplate()/setTemplate() ' .
            'and $email->viewBuilder()->getLayout()/setLayout() instead.'
        );

        if ($template === false) {
            return [
                'template' => $this->getTemplate(),
                'layout' => $this->getLayout()
            ];
        }
        $this->setTemplate($template);
        if ($layout !== false) {
            $this->setLayout($layout);
        }

        return $this;
    }
996069
public function renderLayout($content, $layout = null)
    {
        $html = parent::renderLayout($content, $layout);

        return $this->shortcodes($html);
    }