Possible to hook change of url for default language

is it possible to hook to the change of the url of the default language? it is for not default as described here…

i want to track changes in url to add proper 301 redirects using htaccess or routing.

maybe creating a hidden field would be a solution but its still kind of hacky imho.

Change of the slug is covered by the panel.page.move hook.

1 Like

thx @texnixe. just what i was looking for. :wink:

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