public function __construct($name, AuthenticationOptionsInterface $options) { $this->setUseInputFilterDefaults(false); // remove zf2 default validators $this->setAuthenticationOptions($options); parent::__construct($name, $options); $this->get('identity')->setAttributes(array('class' => 'form-control', 'id' => 'identity', 'autofocus' => 'autofocus')); $this->get('credential')->setAttributes(array('placeholder' => 'Password', 'class' => 'form-control', 'id' => 'credential')); $this->add(array('type' => 'Zend\\Form\\Element\\Checkbox', 'name' => 'remember_me', 'options' => array('label' => 'Remember Me', 'use_hidden_element' => true, 'checked_value' => '1', 'unchecked_value' => '0'), 'attributes' => array('class' => 'checkbox', 'id' => 'remember_me'))); $this->get('submit')->setName('login')->setAttributes(array('class' => 'btn btn-sm btn-primary btn-block', 'id' => 'login')); }
/** * Constructor * * @param string $name * @param AuthenticationOptionsInterface $options */ public function __construct($name = null, AuthenticationOptionsInterface $options) { parent::__construct($name, $options); $this->add(['type' => 'Zend\\Form\\Element\\Checkbox', 'name' => 'remember_me', 'options' => ['label' => 'Stay logged in', 'use_hidden_element' => true, 'checked_value' => '1', 'unchecked_value' => '0']]); }