Custom page creation modal in Admin

Using this recipe: https://learn.getgrav.org/cookbook/admin-recipes#add-a-custom-page-creation-modal

I’ve added custom modal for page type “news”. How can i set default page template to use with this form? Also how can i set taxonomy category to some default value when using this form?

Template selection via custom page creation modal is selected with the name.
So if you want to use the sometemplate.html.twig template you would have to use

name:
  type: hidden
  default: 'sometemplate'

For adding taxonomy, this is instead done on the page blueprint itself, not on the creation modal, you can add a default attribute with your tag.

hope it helps

I’ve tried this and it didn’t work for me. You just provide path to template like mainpage.html.twig or you give full path?

If i do this in a blueprint, then all news would have the same category, i want to set custom default category when using this custom page creation modal, is this possible?

no, you just use the template name, without the .html.twig extension example:
mytemplate.html.twig -> mytemplate
blog-article.html.twig -> blog-article

If i do this in a blueprint, then all news would have the same category, i want to set custom default category when using this custom page creation modal, is this possible?

It is not possible afaik

I’ve used twig extension … :slight_smile: That’s why it didn’t work, ty. If i do not mention default template what it will be using?

Page creation modal functionality is very limited as i understand? It’s just a modal to create a page? Can’t set custom field values using it? Only in a page blueprint?

Page creation modal functionality is very limited as i understand? It’s just a modal to create a page? Can’t set custom field values using it? Only in a page blueprint?

Yes, at least for now

1 Like