Is it possible, when I save changes to a page in panel, to autofill the URL-appendix from multiple fields?
My blueprint is:
A sample content.txt page would be:
I would like the URL-appendix, when I save the page from panel, to be automatically updated to:
It could be done via a panel.page.update hook, but I’m not sure what happens in the panel if the page is moved, you’ll probably get an error message, because the file you are currently editing suddenly doesn’t exist anymore.
You could do it with a route and a model though. Instead of actually renaming the page, a route would find the item based on the values of the pages. You can then use a page model that overrides the
uid() method with your custom URL structure so that the links to the pages are correct.
I am asking because I will have one folder full if thousands of products, dozens of which with the same brand:
It would then be handy for me to have the actual folder name to be build from
In this case, @lukasbestle’s suggestion will not work, because you cannot create pages with the same uid. Is there a reason why you don’t want to create the correct name for the folder at page creation?
How about the panel.page.update? Can you point me closer to the file / section I should look at? I’ve tried searching for panel.page.update through the project, but I couldn’t really tell / find if there is a specific section that rules how to write URL-appendix.
You would still have the same problem as with the panel.page.create. As soon as the page is renamed by the hook action, you would get an error in the panel, because the link to the page you are editing would no longer exist. I cannot recommend this because of bad user experience.
You can find the hook documentation here
To rename a page url, use