How to get the layout name in the controller?

in AppController.php I have:

    public function beforeFilter(EventInterface $event)

How do I get the layout name in the controller or in the component?

Thank You…

The ViewBuilder class has a public getLayout() method so from a controller you should be able to


In a Component you would need to


Here are more useful details of the ViewBuilder class

it returns null. :expressionless:

I can confirm in my code that if I have not explicitly set it, it will report null.

In the null case, I assume in that case the layout will eventually be set to ‘default’.