Template not correctly shown in permissions?

I am trying to get the template of the current page in the permissions array in the role (site/roles/editor.php) but for some pages it returns “default” instead of the expected template name?

'panel.page.update'   => function() {
        var_dump( $this->target()->page()->template() ); die;
    },  

this returns “default”…

But the following

'panel.page.update'   => function() {
        var_dump( $this->target()->page()->blueprint()->name() ); die;
    },

returns the expected template name.

The problem is that the first function for some pages does return the correct template name, but then for others it doesn’t? I don’t get it and I don’t really know where to start debugging this. Can someone help? — thx

Does the template exist for those pages? Otherwise, try to use intendedTemplate().

Ugh. I feel stupid now. This works ofcourse.

Thank you very much for the reply at the speed of light, @texnixe Sonja!

1 Like