LastCallMedia / Mannequin

Mannequin Component Theming Tool
https://mannequin.io/
MIT License
38 stars 8 forks source link

Fatal error: Drupal\Core\DependencyInjection\ContainerNotInitializedException thrown when using {% trans %} #129

Closed marcus-n3rd closed 3 years ago

marcus-n3rd commented 6 years ago

If I use Drupal 8's TranslatableMarkup Twig tag, there is an exception thrown that's not caught by Mannequin.

For instance:

{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}

Throws:

( ! ) Fatal error: Drupal\Core\DependencyInjection\ContainerNotInitializedException thrown while calling __toString on a Drupal\Core\StringTranslation\TranslatableMarkup object in /path/to/mannequintest/drupal/core/lib/Drupal.php on line 129: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in /path/to/mannequintest/drupal/core/lib/Drupal/Component/Utility/ToStringTrait.php on line 20
--

1  | 0.0000 | 355808  | {main}( ) | .../router.php:0
2  | 0.0024 | 598640  | Silex\Application->run( ) | .../router.php:42
3  | 0.0026 | 686704  | Silex\Application->handle( ) | .../Application.php:477
4  | 0.0046 | 892056  | Symfony\Component\HttpKernel\HttpKernel->handle( ) | .../Application.php:496
5  | 0.0047 | 892792  | Symfony\Component\HttpKernel\HttpKernel->handleRaw( ) | .../HttpKernel.php:68
6  | 0.2522 | 2848688 | call_user_func_array:{/Users/nerdacus/Sites/mannequintest/drupal/vendor/symfony/http-kernel/HttpKernel.php:153} ( ) | .../HttpKernel.php:153
7  | 0.2522 | 2849096 | LastCall\Mannequin\Core\Ui\Controller\RenderController->renderAction( ) | .../HttpKernel.php:153
8  | 0.2522 | 2849096 | LastCall\Mannequin\Core\Ui\Controller\RenderController->renderComponent( ) | .../RenderController.php:43
9  | 0.2522 | 2849096 | LastCall\Mannequin\Core\ComponentRenderer->render( ) | .../RenderController.php:55
10 | 0.2522 | 2849792 | LastCall\Mannequin\Core\ComponentRenderer->enterRender( ) | .../ComponentRenderer.php:44
11 | 0.2522 | 2849792 | LastCall\Mannequin\Core\ComponentRenderer->LastCall\Mannequin\Core\{closure}( ) | .../ComponentRenderer.php:51
12 | 0.2609 | 3022288 | LastCall\Mannequin\Core\Engine\DelegatingEngine->render( ) | .../ComponentRenderer.php:40
13 | 0.2610 | 3022288 | LastCall\Mannequin\Twig\Engine\TwigEngine->render( ) | .../DelegatingEngine.php:57
14 | 0.2610 | 3022288 | Twig_Environment->render( ) | .../TwigEngine.php:28
15 | 0.2610 | 3022288 | Twig_Template->render( ) | .../Environment.php:362
16 | 0.2610 | 3038752 | Twig_Template->display( ) | .../Template.php:411
17 | 0.2610 | 3039128 | Twig_Template->displayWithErrorHandling( ) | .../Template.php:403
18 | 0.2610 | 3039128 | __TwigTemplate_819319bab4be091c1c43d4c1914d07476b3b998de403aa441d59f25c0b498394->doDisplay( ) | .../Template.php:432
19 | 0.2612 | 3041456 | Drupal\Core\StringTranslation\TranslatableMarkup->__toString( ) | .../90e56c7529d61527a6059bb69c8a4d5f55616af06a432055a88d504359cf922d.php:65
20 | 0.2614 | 3080320 | trigger_error ( ) | .../ToStringTrait.php:20

Specs:

rbayliss commented 6 years ago

Huh, it looks like the trans node is not being parsed properly. We'll have to take a look at this.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days