Created
June 19, 2025 18:08
-
-
Save megclaypool/a1c517f000303c9f06d83047a2785a2e to your computer and use it in GitHub Desktop.
[How to load a Drupal entity by ID in Twig.md]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The magic secret is the drupal_entity function! | |
| ```twig | |
| {% set object = drupal_entity('ENTITY_TYPE', ID, 'VIEW_MODE')) %} | |
| ``` | |
| Ex: | |
| ```twig | |
| {% set object = drupal_entity('node', 123, 'default')) %} | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment