Manuel Vencato
Manuel Vencato

Reputation: 73

CakePHP 3 - Same layout for actions with the same name

I need all actions Add() have the same layout. There is a way to have that without editing every single action Add() in every single controller?

Upvotes: 0

Views: 128

Answers (1)

ndm
ndm

Reputation: 60503

Use the beforeFilter() callback in your app controller, check the action name, and set the layout accordingly.

public function beforeFilter()
{
    if($this->request->param('action') === 'add') {
        $this->layout = 'some_layout';
    }
}

See also

Upvotes: 1

Related Questions