Commit 7e18d45e authored by xjm's avatar xjm

Issue #3040210 by Spokje, phenaproxima, shaal, lauriii, hctom, a.dmitriiev,...

Issue #3040210 by Spokje, phenaproxima, shaal, lauriii, hctom, a.dmitriiev, xjm, cilefen, eelkeblok: Updating twig/twig to v1.38.2 (included in Drupal 8.6.11) causes fatal error when embed tags are used in templates
parent be9af5bd
......@@ -104,4 +104,11 @@ public function renderable() {
];
}
/**
* Renders for testing the embed tag in a Twig template.
*/
public function embedTagRender() {
return ['#theme' => 'twig_theme_test_embed_tag'];
}
}
This line is from twig_theme_test/templates/twig-theme-test-embed-tag-embedded.html.twig
{% embed "@twig_theme_test/twig-theme-test-embed-tag-embedded.html.twig" %}
{% endembed %}
......@@ -73,6 +73,10 @@ function twig_theme_test_theme($existing, $type, $theme, $path) {
],
'template' => 'twig_theme_test.renderable',
];
$items['twig_theme_test_embed_tag'] = [
'variables' => [],
'template' => 'twig_theme_test.embed_tag',
];
return $items;
}
......
......@@ -69,3 +69,10 @@ twig_theme_test_renderable:
_controller: '\Drupal\twig_theme_test\TwigThemeTestController::renderable'
requirements:
_access: 'TRUE'
twig_theme_test_embed_tag:
path: '/twig-theme-test/embed-tag'
defaults:
_controller: '\Drupal\twig_theme_test\TwigThemeTestController::embedTagRender'
requirements:
_access: 'TRUE'
<?php
namespace Drupal\Tests\system\Functional\Theme;
use Drupal\Tests\BrowserTestBase;
/**
* Tests Twig environment.
*
* @group Theme
*/
class TwigEnvironmentTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['twig_theme_test'];
/**
* Tests template class loading with Twig embed.
*/
public function testTwigEmbed() {
$assert_session = $this->assertSession();
// Test the Twig embed tag.
$this->drupalGet('twig-theme-test/embed-tag');
$assert_session->statusCodeEquals(200);
$assert_session->responseContains('This line is from twig_theme_test/templates/twig-theme-test-embed-tag-embedded.html.twig');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment