Hi community,
according to the discussion from Allow users to change field label and calling field label in template:
I’d like to have different labels for some fields in different pages that all share the same blueprint. The mentioned article showed me how to access the blueprint elements correctly. I’m trying to get this to work in a page.create:after hook as follows (abrigdged for clarity):
In a real world example, the string "Special subpages" would be replaced by some smart function evaluating the desired label from both $parent and $page.
So far I had no luck with this approach. The label initally present in the overview blueprint remains stuck to the field subpages in the blueprint of my new subpage.
How can I make this work? Another event to hook on (perhaps page.create:before)? Where can I find an explanation in the docs?
$page->blueprint() reads the blueprint and returns the values defined there. You cannot, however, change these values unless you would actually parse the blueprint, make your changes and save the changed values back to the blueprint file. But then you would end up with the same result, i.e. the same label for all pages that use the blueprint.
Thanks again. I have already a page model for my overview page. I’ll try that, hopefully figuring out the required blueprint query syntax. I think that must go along the line