diff --git a/core/includes/theme.inc b/core/includes/theme.inc index cb62241..d7f22a7 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1041,10 +1041,10 @@ function theme_disable($theme_list) { * @return string * The rendered inline template. */ -function drupal_render_twig_inline(&$element) { +function drupal_render_inline_template(&$element) { /** @var \Drupal\Core\Template\TwigEnvironment $environment */ $environment = \Drupal::service('twig'); - $markup = $environment->renderInlineTemplate($element['#template'], $element['#context']); + $markup = $environment->renderInline($element['#template'], $element['#context']); $element['#markup'] = $markup; return $element; } diff --git a/core/lib/Drupal/Core/Template/TwigEnvironment.php b/core/lib/Drupal/Core/Template/TwigEnvironment.php index f0a8050..6c2f673 100644 --- a/core/lib/Drupal/Core/Template/TwigEnvironment.php +++ b/core/lib/Drupal/Core/Template/TwigEnvironment.php @@ -211,7 +211,7 @@ public function getTemplateClass($name, $index = NULL, $inline = FALSE) { /** * Renders a twig string directly. * - * Warning: You should use the render element 'twig_inline' together with + * Warning: You should use the render element 'inline_template' together with * the #template attribute instead of this method directly. * On top of that you have to ensure that the template string is not dynamic * but just an ordinary static php string, because there may be installations @@ -228,7 +228,7 @@ public function getTemplateClass($name, $index = NULL, $inline = FALSE) { * @return string * The rendered inline template. */ - public function renderInlineTemplate($template_string, array $context = array()) { + public function renderInline($template_string, array $context = array()) { return $this->loadTemplate($template_string, NULL, TRUE)->render($context); } diff --git a/core/modules/field_ui/src/DisplayOverviewBase.php b/core/modules/field_ui/src/DisplayOverviewBase.php index 574900e..c3e9672 100644 --- a/core/modules/field_ui/src/DisplayOverviewBase.php +++ b/core/modules/field_ui/src/DisplayOverviewBase.php @@ -405,7 +405,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent if (!empty($summary)) { $field_row['settings_summary'] = array( - '#type' => 'twig_inline', + '#type' => 'inline_template', '#template' => '
{{ summary|safe_join("
") }}
', '#context' => array('summary' => $summary), '#cell_attributes' => array('class' => array('field-plugin-summary-cell')), diff --git a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php b/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php index c4f5c2c..3f90e8d 100644 --- a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php +++ b/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php @@ -30,12 +30,12 @@ class TwigEnvironmentTest extends KernelTestBase { public function testInlineTemplate() { /** @var \Drupal\Core\Template\TwigEnvironment $environment */ $environment = \Drupal::service('twig'); - $this->assertEqual($environment->renderInlineTemplate('test-no-context'), 'test-no-context'); - $this->assertEqual($environment->renderInlineTemplate('test-with-context {{ lama }}', array('lama' => 'muuh')), 'test-with-context muuh'); + $this->assertEqual($environment->renderInline('test-no-context'), 'test-no-context'); + $this->assertEqual($environment->renderInline('test-with-context {{ lama }}', array('lama' => 'muuh')), 'test-with-context muuh'); $element = array(); $element['test'] = array( - '#type' => 'twig_inline', + '#type' => 'inline_template', '#template' => 'test-with-context {{ lama }}', '#context' => array('lama' => 'muuh'), ); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 6483578..2fc1883 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -304,8 +304,8 @@ function system_element_info() { '#theme' => 'page', '#title' => '', ); - $types['twig_inline'] = array( - '#pre_render' => array('drupal_render_twig_inline'), + $types['inline_template'] = array( + '#pre_render' => array('drupal_render_inline_template'), '#template' => '', '#context' => array(), ); diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 1319a7f..2a3e122 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -679,8 +679,8 @@ public function renderPreview($display_id, $args = array()) { } } $rows['query'][] = array( - array('data' => array('#type' => 'twig_inline', '#template' => "{% trans 'Query' %}")), - array('data' => array('#type' => 'twig_inline', '#template' => '
{{ query }}
', '#context' => array('query' => strtr($query_string, $quoted)))), + array('data' => array('#type' => 'inline_template', '#template' => "{% trans 'Query' %}")), + array('data' => array('#type' => 'inline_template', '#template' => '
{{ query }}
', '#context' => array('query' => strtr($query_string, $quoted)))), ); if (!empty($this->additionalQueries)) { $queries = '' . t('These queries were run during view rendering:') . ''; @@ -693,14 +693,14 @@ public function renderPreview($display_id, $args = array()) { } $rows['query'][] = array( - array('data' => array('#type' => 'twig_inline', '#template' => "{% trans 'Other queries' %}")), + array('data' => array('#type' => 'inline_template', '#template' => "{% trans 'Other queries' %}")), SafeMarkup::set('
' . $queries . '
'), ); } } if ($show_info) { $rows['query'][] = array( - array('data' => array('#type' => 'twig_inline', '#template' => "{% trans 'Title' %}")), + array('data' => array('#type' => 'inline_template', '#template' => "{% trans 'Title' %}")), Xss::filterAdmin($this->executable->getTitle()), ); if (isset($path)) {