-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The current proper way to nest patterns? #245
Comments
HI @Itshalffull Here are real life examples of patterns nesting:
...in a render array:
Is it helping? |
{% if link_url and link_text %}
{% set links = pattern('link', {
'label': link_label,
'uri': link_uri,
}) %}
{% endif %}
<div class="hero__links">{{ links }}</div> In this case, the |
That's weird because:
What do you have in links?
Maybe, you will have to build the render array by yourself, a bit like that:
|
Continuing with the use case I mentioned in my comment above, I am populating |
hi @jigarius i have updated my last comment with a proposal based on a render array built directly from Twig |
This works fine, however, the preview of the inner pattern doesn't work - is it supposed to be working? Or do I have to use something like {% if title is empty %}
{% set title = 'Title' %}
{% endif %}
{% if body is empty %}
{% set body = 'Skákal pes přes oves' %}
{% endif %} in the inner pattern? |
Hey there,
I'm having trouble finding the proper syntax for nesting patterns, both in an actual drupal website using for instance nested paragraphs, as well as how to show nested patterns in a preview.
I see different syntaxes in:
This presentation: https://www.drupalgovcon.org/sites/default/files/session/slides/2018-05/component_theming_ui_patterns.pdf
This theme: https://github.com/SU-SWS/stanford_components/blob/8.x-1.x/patterns/molecules/calendar-blocks/calendar-blocks.ui_patterns.yml
This issue: Next steps before stable releases: Variants, Subfields, Multiple fields, Tags and Hidden patterns #76
Curious if this is currently supported and how to go about making it work.
Thanks,
Matt
The text was updated successfully, but these errors were encountered: