Please tell me how to get the name of a modular page template using twig? It is necessary to insert in the templates instead of the id.
Thanks!
Community guidelines
Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.
Archive
You can find this twig variable using dump(). Open up modular.html.twig and add dump() like this:
TWIG
{% for module in page.collection() %}
{{ dump(module) }}
etc.
etc.
You need to enable the debugger in admin/config/system, then load your modular page and you'll see the debugger bar along the bottom of the page. Click on messages, and you'll see something like this for each modular subpage:
TXT
Grav\Common\Page\Page {#167 #name: ...
If you click on this you'll see all the available twig variables for that subpage. One of them will be the template for that subpage.
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 1282 | 9 years ago | ||
| 2 | 889 | 9 years ago | ||
| 2 | 4019 | 9 years ago | ||
| 1 | 2894 | 9 years ago | ||
| 3 | 1078 | 9 years ago |