Field (way) to manage url-key in panel by editors?


I’m investigating best practices on how to setup the “URL-key” field in the panel to be used by site editors in a “bullet proof” way?

I added a text field URL-key in the blueprint but that has a few downsides imho:

  • Panel displays the field in the default language even though it doesn’t work there.
  • “text”-field has no cleanup for “non-nice” URL characters such as spaces/uppercase chars etc. -> In short: it doesn’t cleanup the slug at all.

How do you do it? — thanks

I’m not sure if I understood your question correctly.
But the sidebar link “change URL” changes the URL-key in other languages. So if you’re in the default language, for example english, it changes the UID, if you’re in french for example, it changes the URL-key.

Thanks for your answer.

Aha, you do it like that.
I had disabled that option to avoid editors to change the folder name of the content in the default language because I use page()->find(“id”) queries in the templates :smirk:

Is there a way “enable” that on the “non-default language” pages in the panel, but disable it on the default language?

That should be possible using the permissions feature, if you use a callback instead of just true/false (with the downside that you would have to apply that for every user role)

Thanks @texnixe,

Should the code below do that?
(only the part from, the rest is boilerplate code)


return [
    'name'        => 'Editor',
    'default'     => false,
    'permissions' => [
        '*'                 => true,
        '' => false,
        'panel.user.*'      => false,
        ''   => true,
        'panel.user.update' => function() {

            if($this->user()->is($this->target()->user())) {
                // users are allowed to edit their own information
                return true;
            } else {
                // other users can't be edited
                return false;

        '' => function() {

            if ($this->language() === 'en') {
                return false;
            } else {
                return true;


$this-language() always returns “en” (which is my default language) in my site.
Am I doing something wrong?

Turns out it should be:

if($this->site()->language() === 'en') {

Docs are wrong or misleading, I’m afraid.

1 Like

This works. I’m afraid there are indeed errors in docs (or un-documented things for multi-lang setups).

Thank you very much!

I’ve created an issue in the repo, just not sure if the docs are wrong or if this is a bug.

It might well be that we changed it again after I wrote the initial docs. Permissions were a long journey. :slight_smile:
@bastianallgeier should know more.

All good @lukasbestle :slight_smile:, I got it working and Sonja filed an issue at github.

Keep up the good work.