Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Template from Plugin not usable in Admin

Solved by Werner Joss View solution

Started by Werner Joss 6 years ago · 2 replies · 940 views
6 years ago

I'm currently stumbling over an IMHO strange behaviour when trying to use a template from my plugin in the admin backend.
I followed the official docs and then created calendar.html.twig in my plugin's template directory.
now when I create a new page, I thought it would be possible to select this template as Page Template, but it does not work.
I can, however, create a file calendar.md in a new page folder, an then, in the admin, it looks like this:
grafik|690x247

  • note that the type calendar is correctly displayed, and I can also see that the template is actually used when I look at the page, but: I can't select the correct template in the dropdown - my custom type is just not displayed there, so, saving the page in the admin is not possible, because it will be of a wrong type.
    did I miss something here ?
6 years ago Solution

ok, the solution seems to be simple, I had to use the Override Option for Display templates:
grafik|523x499
so, as a conclusion, page save in admin does work and preserve the correct page type,
but that ist not selectable in the dropdown, where only the templates from the theme will be shown.

👍 1
6 years ago

just to complete this issue, after some more investigation, I found a much more elegant solution here, which actually allows direct selection of plugin-provided templates in the admin.
this is now also implemented in the latest version of my fullcalendar plugin.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by DrPen, 1 month ago
2 478 1 month ago
Plugins · by renedebaaij, 2 months ago
1 351 1 month ago
Plugins · by Thomas, 1 month ago
1 375 1 month ago
Plugins · by complanar, 2 months ago
6 699 2 months ago
Plugins · by BenLaKnet, 2 months ago
1 642 2 months ago