bnomei
April 20, 2016, 10:47am
1
is it possible to hook to the change of the url of the default language? it is for not default as described here…
https://forum.getkirby.com/t/setting-url-key-automatically/1628/3
i want to track changes in url to add proper 301 redirects using htaccess or routing.
bnomei
April 20, 2016, 10:48am
2
maybe creating a hidden field would be a solution but its still kind of hacky imho.
So you need to inform this third person of both the changes that are done via the panel by the admin and the changes by team members via the custom form? For the first scenario, you can use a panel hook, for the second, you could handle this via your form processing script after the page is successfully updated?
Change of the slug is covered by the panel.page.move
hook.
1 Like
bnomei
April 20, 2016, 11:05am
4
thx @texnixe . just what i was looking for.
Maybe add an issue to rename this hook to panel.page.rename
instead? What do you think?
We’ve had this discussion before . I think it makes sense to keep it to be future-proof.
I think it’s more logical this way:
For renaming the slug:
panel.page.rename
For moving page level:
panel.page.move
Your idea is that they should use the same hook? I think it’s two different actions.
Well, that’s kind of true. For me both actions are “the folder name changes”, so I think one hook is fine. But you are of course right that there could be different actions associated with the hooks.
I also think it would make sense to have two different hooks once pages can actually be moved around in the panel.
1 Like
Would it hurt to have two hooks?
Let’s pretend that we can move level in the panel and that there are two different hooks for rename and move.
Then a real case for it is my revisions plugin. I would do this:
If a page is renamed, I would rename the current revision folder. (panel.page.rename
)
If a page is moved to another level, I would move the current revision folder to another level as well. (panel.page.move
)
Maybe it’s possible to figure out what action is used another way, but it would be much easier if the hook was just there to use.
As I already wrote, that point of view is totally fine. I have seen it differently until now, but I’m not against renaming the hook and then creating a second one in the future.
Only issue: Renaming something always breaks backwards compatibility so we have to be careful how to do it.
1 Like
I added an issue about it. Then Bastian can figure out what to with it, or discuss it more with you…
1 Like