Renders template tag.

@param string $name
@param string $type
@param array $parameters
@param bool $isInline

@return string
485738
public function renderTemplate($name, $type, array $parameters, $isInline)
    {
        switch ($type) {
            case 'style':
                $templateName = $this->getStyleTemplateName($name, $isInline);
                break;
            case 'tag':
            default:
                $templateName = $this->getTagTemplateName($name, $isInline);
        }

        if ($templateName === null) {
            $this->logger->error(
                "Could not render template {$type} '{$name}': no template configured"
            );

            return null;
        }

        if (!$this->templateEngine->exists($templateName)) {
            $this->logger->error(
                "Could not render template {$type} '{$name}': template '{$templateName}' does not exist"
            );

            return null;
        }

        return $this->render($templateName, $parameters);
    }
489171
final public static function parameter(
            $name,
            $typeHint = null,
            Expression $defaultValue = null,
            $isPassedByReference = false,
            $isVariadic = false
    ) {
        return new ParameterExpression(
                $name,
                $typeHint,
                $defaultValue,
                $isPassedByReference,
                $isVariadic);
    }
476743
protected function renderWidget($type, $name, $value, $options)
    {
        unset($options['tabindex']);

        $model = $this->getModel();
        if ($model instanceof Model) {
            $widgetOptions = [
                'model'     => $model,
                'attribute' => $this->name,
                'value'     => $value,
                'options'   => [
                    'id'        => $this->normalize($name),
                    'name'      => $name,
                    'tabindex'  => self::TABINDEX,
                    'value'     => $value
                ]
            ];
        } else {
            $widgetOptions = [
                'name'      => $name,
                'value'     => $value,
                'options'   => [
                    'id'        => $this->normalize($name),
                    'name'      => $name,
                    'tabindex'  => self::TABINDEX,
                    'value'     => $value
                ]
            ];
        }

        $options = ArrayHelper::merge($options, $widgetOptions);

        return $type::widget($options);
    }
1052070
public function render(array $options, $name, $selected = array(), array $attrs = array(), $tpl = false)
    {
        $output = array();
        $this->_setTpl($tpl);

        foreach ($options as $value => $label) {
            $label = trim($label);
            $id    = Str::unique($this->_type . '-');
            $value = $this->_cleanValue($value);
            $text  = $this->_translate($label);
            $attrs = $this->_checkedOptions($value, $selected, $attrs);

            $output[] = $this->_elementTpl($name, $value, $id, $text, $attrs);
        }

        return implode(PHP_EOL, $output);
    }
287260
public function template($name, array $params = []): ResponseInterface
    {
        if (\is_array($name)) {
            $params = $name;
            $name = null;
        }

        if ($name === null) {
            $handler = $this->app->handler();
            if ($handler instanceof \Closure) {
                throw new \LogicException('Con not build the template from closure handler!');
            }

            $name = \ltrim($handler['app'] . '/' . $handler['controller'] . '/' . $handler['action'], '/');
        } elseif (!\is_string($name)) {
            throw new \InvalidArgumentException('Template name not found!');
        }

        $response = $this->response();

        return $this->app->render($response, $name, $params);
    }
1010458
protected function addColumn($type, $name, array $parameters = array())
    {
        $attributes = array_merge(compact('type', 'name'), $parameters);

        $this->columns[] = $column = new Fluent($attributes);

        return $column;
    }
1039201
public function render($name, array $context = [])
    {
        $renderedHtml = $this->twig->render($name, $context);

        foreach ($this->postProcessors as $postProcessor) {
            if ($postProcessor instanceof PostProcessorInterface) {
                $renderedHtml = $postProcessor->process($renderedHtml, $name, $context, $this->twig);
            }
        }

        return $renderedHtml;
    }
1022222
protected void __invokeTag(int line, String name, ITag.__ParameterList params) {
        __engine.invokeTemplate(line, name, this, params, null, null);
    }
213776
public function render($name = '', $content = '', array $attrs = array(), $type = 'submit')
    {
        $attrs = array_merge(array('text' => null, 'name' => $name), $attrs);

        $attrs = $this->_getBtnClasses($attrs);
        $attrs['type'] = $type;

        if (Arr::key('icon', $attrs)) {
            $content = '<i class="' . $this->_icon . '-' . $attrs['icon'] . '"></i> ' . $this->_translate($content);
            unset($attrs['icon']);
        }

        return '<button ' . $this->buildAttrs($attrs) . '>' . $content . '</button>';
    }
665666
protected function renderElement(string $name, array $options = []) : string
    {
        return $this->config->getView()
            ->element($name, $options);
    }
482456
public function renderEvent($name, array $options = [])
    {
        $eventName = sprintf('sonata.block.event.%s', $name);

        /** @var BlockEvent $event */
        $event = $this->eventDispatcher->dispatch($eventName, new BlockEvent($options));

        $content = '';

        foreach ($event->getBlocks() as $block) {
            $content .= $this->render($block);
        }

        if ($this->stopwatch) {
            $this->traces['_events'][uniqid('', true)] = [
                'template_code' => $name,
                'event_name' => $eventName,
                'blocks' => $this->getEventBlocks($event),
                'listeners' => $this->getEventListeners($eventName),
            ];
        }

        return $content;
    }
1318507
private function getTwigBlockContent(
        TwigBlockDefinitionInterface $blockDefinition,
        Block $block,
        array $parameters
    ): string {
        if (!isset($parameters['twig_template'])) {
            return '';
        }

        if (!$parameters['twig_template'] instanceof ContextualizedTwigTemplate) {
            return '';
        }

        return $parameters['twig_template']->renderBlock(
            $blockDefinition->getTwigBlockName($block)
        );
    }
412735
protected function render($type, array $data = [])
    {
        $templateName = empty($data['title']) ? $type.'_notitle' : $type;
        $template = $this->templates[$templateName];

        if (is_callable($template)) {
            return $template($data);
        } else {
            $replace = array();

            foreach ($data as $key => $value) {
                $replace['{'.$key.'}'] = $key != 'html' ? $this->escapeHtml($value) : (string) $value;
            }

            return strtr($template, $replace);
        }
    }
40143
public function render($type = 'html', $template = null)
    {
        if (!$this->isTableInit()) {
            $this->initializable();
        }

        if ($type == 'html') {
            return $this->getRender()->renderTableAsHtml();
        } elseif ($type == 'dataTableAjaxInit') {
            return $this->getRender()->renderDataTableAjaxInit();
        } elseif ($type == 'dataTableJson') {
            return $this->getRender()->renderDataTableJson();
        } elseif ($type == 'custom') {
            return $this->getRender()->renderCustom($template);
        } elseif ($type == 'newDataTableJson') {
            return $this->getRender()->renderNewDataTableJson();
        } else {
            throw new Exception\InvalidArgumentException(sprintf('Invalid type %s', $type));
        }

    }
1365296
public function renderPlainText($template, array $variables = [], $type = MailTypes::TYPE_ALL)
    {
        return $this->getMailRendered($template, $variables, $type)->getBody();
    }
1198160
private function createTag(string $body, string $name, TypeContext $context): ?Tag
    {
        $handlerClassName = $this->findHandlerClassName($name, $context);
        $arguments = $this->getArgumentsForParametersFromWiring(
            $this->fetchParametersForHandlerFactoryMethod($handlerClassName),
            $this->getServiceLocatorWithDynamicParameters($context, $name, $body)
        );

        return call_user_func_array([$handlerClassName, 'create'], $arguments);
    }
349475
public function render(array $parameters = []): string
    {
        /** @var Location $location */
        $location = $parameters['location'];
        /** @var Content $content */
        $content = $parameters['content'];
        /** @var Language $language */
        $language = $parameters['language'];
        $versionNo = $content->getVersionInfo()->versionNo;

        // nonpublished content should use parent location instead because location doesn't exist yet
        if (!$content->contentInfo->published && null === $content->contentInfo->mainLocationId) {
            $parentLocations = $this->locationService->loadParentLocationsForDraftContent($content->getVersionInfo());
            $location = reset($parentLocations);
            $versionNo = null;
        }

        $siteaccesses = $this->siteaccessResolver->getSiteaccessesForLocation(
            $location,
            $versionNo,
            $language->languageCode
        );

        if (empty($siteaccesses)) {
            return $this->twig->render(
                '@ezdesign/content/content_edit/component/preview_unavailable.html.twig'
            );
        }

        return '';
    }