/** * User login form block * * @param array $options * * @return bool|array */ public static function login($options = array()) { if (Pi::service('user')->hasIdentity()) { return false; } if (Pi::service('module')->isActive('user')) { $form = new LoginFormUser('login'); } else { $form = new LoginFormSystem('login'); } if (!empty($options['route'])) { $route = $options['route']; unset($options['route']); } else { $route = Pi::service('user')->getRoute(); } if (!empty($options['action'])) { $action = $options['action']; unset($options['action']); } else { $action = Pi::service('url')->assemble($route, array('module' => 'system', 'controller' => 'login', 'action' => 'process')); } if ($options) { $form->setData($options); } $form->setAttribute('action', $action); return array('form' => $form); }
/** * Load login form * * @param array $config * * @return LoginForm */ protected function getForm(array $config) { $form = new LoginForm('login', $config); $form->setAttribute('action', $this->url('', array('controller' => 'login', 'action' => 'process'))); return $form; }