InlineTemplate.php in Zircon Profile 8.0
File
core/lib/Drupal/Core/Render/Element/InlineTemplate.php
View source
<?php
namespace Drupal\Core\Render\Element;
class InlineTemplate extends RenderElement {
public function getInfo() {
$class = get_class($this);
return array(
'#pre_render' => array(
array(
$class,
'preRenderInlineTemplate',
),
),
'#template' => '',
'#context' => array(),
);
}
public static function preRenderInlineTemplate($element) {
$environment = \Drupal::service('twig');
$markup = $environment
->renderInline($element['#template'], $element['#context']);
$element['#markup'] = $markup;
return $element;
}
}
Classes
Name |
Description |
InlineTemplate |
Provides a render element where the user supplies an in-line Twig template. |