Hi everybody,
for the creation of a new (sub-)page, I’d like to have the appropriate templates in a particular order for the end user’s convenience. At the same time, templates that are irrelevant for the end user, should be filtered out. In the blueprint site.yml, I employ the following code:
title: Site
preset: pages
unlisted: true
templates:
- overview
- detail
- list
- section
- main
This works very fine as intended. But having this on the site level, also the admin suffers from the template filtering.
Where do I have to put that templates: property so that it does not affect the admin account but only everyone else?
Thanks in advance for helping. You’re doing an awesome job!
@texnixe Thanks for replying that fast at this time of the year!
There are more templates than those mentioned in my post, partly because they are not used yet, partly because the customer will not need them. But the customer in the role of the end user wants to evaluate intermediate statuses. (We agreed on this, so he can see what he is about to get and say more precisely what he expects during development. He could not do this before, because he is not an IT native and not able to structure his wishes, so it is iterating. Sigh.)
Therefore the necessity of filtering. The sorting is necessary in order to help him to choose the right template when creating new pages (new products, e.g.) because the default alphabetic ordering is by no means adequate.
This implementation registers blueprints in a plugin, for example, a custom home.yml for clients, and a general home.yml for all other user roles.
:
Possible downsides
You have to maintain multiple blueprints for a page type.
Only pages blueprints are mentioned, so does that work too only for the site.yml?
What am I supposed to enter in the snippet for the ??? ?
Thanks for your help so far. At the moment, I am stuck with integrating the solution into the index.php. Alas I have to leave right now and will be back after 3 p.m. So I’ll keep you informed.
I tested my idea from above just to be sure and it works as expected, so instead of creating blueprints for pages or the site based on user role, the same can be done for section blueprints.
Although I just noticed that you are using a pages blueprint preset instead of defining the sections manually. In that case, it doesn’t make sense, of course, and you would have to stick with defining the two site.yml files in your plugin.
Note that if you do this, you have to remove the standard site.yml from the /blueprints folder, because files in this folder overwrite what you define in the plugin.
This is my index.php in the plugin directory. Note however that I prefer to have the site blueprints under the standard directory for all blueprints (site/blueprints), and not in the plugin directory. Of course, there is no more site.yml in this directory.
Many thanks, have a beautiful rest of this year and a successful fresh start into 2021. Same goes for the rest of your team!
I pretty much regret to have to re-open this issue. The plugin solution described earlier does exactly what it is supposed to do.
Unfortunately, this only affects the outermost level of the page hierarchy. As soon as I step one level deeper, creating a sub-page of an existing page, the template select box again shows all available templates in a pretty much random order.
This is no longer the question whether this affects the admin user or not. I tried to employ those templates: options in blueprints for the sub-pages, but to no avail. Seems to me that it only gets honored in the *-site.yml files.
Which options do I have to control which templates can and should be used for sub-pages of a particular existing page?