diff -u b/core/lib/Drupal/Core/Template/TwigEnvironment.php b/core/lib/Drupal/Core/Template/TwigEnvironment.php --- b/core/lib/Drupal/Core/Template/TwigEnvironment.php +++ b/core/lib/Drupal/Core/Template/TwigEnvironment.php @@ -10,8 +10,6 @@ use Drupal\Core\PhpStorage\PhpStorageFactory; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ThemeHandlerInterface; -use Twig_Loader_Chain; -use Twig_Loader_String; /** * A class that defines a Twig environment for Drupal. @@ -69,9 +67,8 @@ $this->templateClasses = array(); - parent::__construct($loader, $options); - - $this->loader = new Twig_Loader_Chain([$loader, new Twig_Loader_String()]); + $this->loader = new \Twig_Loader_Chain([$loader, new \Twig_Loader_String()]); + parent::__construct($this->loader, $options); } /** reverted: --- b/core/modules/content_translation/src/Controller/ContentTranslationController.php +++ a/core/modules/content_translation/src/Controller/ContentTranslationController.php @@ -137,25 +137,8 @@ } $translation = $entity->translation[$langcode]; $status = !empty($translation['status']) ? $this->t('Published') : $this->t('Not published'); + // @todo Remove as part of https://drupal.org/node/2250841. + $status = '' . $status . '' . (!empty($translation['outdated']) ? ' ' . $this->t('outdated') . '' : ''); - $args = array('status' => $status); - if (empty($translation['outdated'])) { - $status = array( - 'data' => array( - '#type' => 'inline_template', - '#template' => '{{ status }}', - '#context' => $args, - ) - ); - } - else { - $status = array( - 'data' => array( - '#type' => 'inline_template', - '#template' => '{{ status }}{{ \'outdated\'|t }}', - '#context' => $args, - ) - ); - } if ($is_original) { $language_name = $this->t('@language_name (Original language)', array('@language_name' => $language_name)); only in patch2: unchanged: --- a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php +++ b/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Theme; +use Drupal\Core\Site\Settings; use Drupal\simpletest\KernelTestBase; /** @@ -40,6 +41,33 @@ public function testInlineTemplate() { '#context' => array('lama' => 'muuh'), ); $this->assertEqual(drupal_render($element), 'test-with-context muuh'); + + + // Enable twig_auto_reload and twig_debug. + $settings = Settings::getAll(); + $settings['twig_debug'] = TRUE; + $settings['twig_auto_reload'] = TRUE; + + new Settings($settings); + $this->container = $this->kernel->rebuildContainer(); + \Drupal::setContainer($this->container); + + $element = array(); + $element['test'] = array( + '#type' => 'inline_template', + '#template' => 'test-with-context {{ lama }}', + '#context' => array('lama' => 'muuh'), + ); + $element_copy = $element; + $element_copy2 = $element; + // Ensure to call it twice that twig caching is triggered. + $this->assertEqual(drupal_render($element), 'test-with-context muuh'); + + $this->container->set('twig', NULL); + $this->assertEqual(drupal_render($element_copy), 'test-with-context muuh'); + + $this->container->set('twig', NULL); + $this->assertEqual(drupal_render($element_copy2), 'test-with-context muuh'); } }