It works like a charm. The only thing is i dont only get redirected when i am editing the Subpage itself but also when i change the status inside the Parentpage. But I am not able to get an If-else statement to work, because I dont know how to get differences.
I thought about testing the path by using Kirby()->path() for example. But its always the path
panel/dialogs/pages/.../changeStatus
Hans anyone an Idea how I can test where I am editing to make an If-else?
The Blogarticle gets moved into a “Year” Subpage that gets build in another hook. So I have the folder structure
Blog
_article_drafts
unpublished-article 1
Year2022
20221109_published-article1
20221004_published-article2
Year2021
Year2020
Unpublished articles move back to Blog->_drafts therefore I ask for the Parent-Intended Template.
This is just “project” code and not necessarily finally.
This is my first plugin with such a complexity and I am not yet very familiar with PHP. So it might be that if clauses are a little over the top or something.
Now I need to figure out if I change status from context menu on a parent page (e.g. ‘year’) in the panel, or if I change the status inside of the article itself to decide if I want to redirect the panel or not.