It’s a login form. It’s almost everywhere (inside default layout). I considered an Element but there is no rendering inside elements. And then I considered calling a controller’s method inside default.ctp and after some search I realized it’s not a good idea.
Then I found out about Cells but I can’t use Auth or Flash or any of the controllers components. So how can I use them? Is it even a good practice? Can I call a controllers method inside a cell to just use the components? Is it a good practice?
Currently the login form is coming from a controller method and has it’s own view:
function login()
{
if ($this->request->is('post')) {
$user = $this->Auth->identify();
if ($user) {
$this->Auth->setUser($user);
return $this->redirect($this->Auth->redirectUrl());
}
$this->Flash->error('Incorrect login.');
}
$this->viewBuilder()->layout(false);
}