Skip to content
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

Using twig in text area in views #137

Open
selwynpolit opened this issue Nov 13, 2024 · 0 comments
Open

Using twig in text area in views #137

selwynpolit opened this issue Nov 13, 2024 · 0 comments

Comments

@selwynpolit
Copy link
Owner

From Mike Anello on Twitter

Yesterday during
@drupaleasy
office hours, I learned that in the #drupal Views module, although it does not indicate it, the “No results behavior” text area (on each field) does allow Twig syntax (similar to the “Rewrite results” text area. )

image

The example we were working with involved using a fallback image dependent on the content type if the image field was empty. Something like:

{% if type=="article" %}
{{ drupal_view('hero_block', 'block_2') }}
{% else %}
{{ drupal_view('hero_block', 'block_3') }}
{% endif $}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant