Problem/Motivation
I ran a test upgrade to Drupal 11.3-beta and got this error when accessing the story pages:
An exception has been thrown during the compilation of a template ("You cannot enable the "use_yield" option of Twig as node "TwigStory
book\Twig\Node\StoriesNode" is not marked as ready for it; please make it ready and then flag it with the #[\Twig\Attribute\YieldReady]
attribute.")
It appears the dependent package https://github.com/e0ipso/twig-storybook is not Twig 4.x compatible.
Proposed resolution
Option #1
I was able to work around this by setting the `services.yml` file to use this variable:
parameters:
twig.config:
use_yield: false
We need a more permenant solution that allows twig to be used with use_yield: true
Option #2
Use the patch from Twig Storybook - Support Twig 4.x with YieldReady #18
Hoping for a quick review/merge then a quick fix release
Not sure if the library will need a new branch
Comments
Comment #2
rajab natshahFacing the same issue
Comment #3
rajab natshahTested the option, Not working, It will break the front-end theme.
Using the following patch from the pull request
Twig Storybook - Support Twig 4.x with YieldReady #18
as in
https://patch-diff.githubusercontent.com/raw/e0ipso/twig-storybook/pull/18.diffHaving a local managed static patch as in
Comment #4
rajab natshahComment #5
rajab natshahComment #6
eelkeblokI did not experience the frontend theme breaking, the patch seems to be working fine, although I did not look into whether it is technically correct. Could you elaborate how the frontend theme broke?
BTW, it is not a best practice to put the URL for a merge request directly into your local patches configuration. With composer patches 1.0, the code in your project may change along with the content of the merge request. I think with composer-patches 2.0 you no longer run that risk, but your build will break instead. Copy the contents of the URL into a local file.
Comment #7
rajab natshahWe had a local managed static patch. As we do that in all our projects.
Now
e0ipso/twig-storybook v1.6.1 was released 2026-01-16
https://github.com/e0ipso/twig-storybook/releases/tag/v1.6.1
The PR for Support Twig 4.x with YieldReady #18 was committed into the release
Comment #8
rjjakes commentedFront end theme actually broke for me too, but was able to conditionally disable yield just for storybook with the attached patch.
Comment #9
rjjakes commentedComment #10
rajab natshahe0ipso/twig-storybook v1.6.1 was released 2026-01-16
https://github.com/e0ipso/twig-storybook/releases/tag/v1.6.1
The PR for Support Twig 4.x with YieldReady #18 was committed into the release