/** * Get login form * * @return \Magelight\Webform\Blocks\Form */ public function getLoginForm() { $form = Form::forge()->setHorizontal()->setConfigs('remindpass-form', $this->url(\Magelight\Config::getInstance()->getConfigString('global/auth/urls/login_url'))); $fieldset = Fieldset::forge(); $fieldset->addRowField(Elements\Input::forge()->setName('email'), __('E-Mail')); $fieldset->addRowField(Elements\PasswordInput::forge()->setName('password'), __('Password')); return $form->addFieldset($fieldset)->createResultRow(true)->addButtonsRow([Elements\Button::forge()->setContent(__('Enter'))->addClass('btn-primary'), Elements\Abstraction\Element::forge()->setTag('a')->setAttribute('href', $this->url('auth/remindpass'))->setContent(__('Remind password'))->setClass('btn')])->loadFromRequest(\Magelight\Http\Request::getInstance())->setValidator($this->getLoginFormValidator()); }
/** * Add form result * * @param string $text * @param string $class * @return Form */ public function addResult($text = '', $class = 'alert-danger') { $res = Result::forge()->setContent($text)->setClass('alert')->addClass($class); if (!$this->resultRow instanceof Elements\Abstraction\Element) { $this->createResultRow(false); } $this->resultRow->addContent($res); return $this; }
/** * Get delete form * * @return \Magelight\Webform\Blocks\Form */ public function getDeleteForm() { if (!$this->deleteForm instanceof \Magelight\Webform\Blocks\Form) { $this->deleteForm = \Magelight\Webform\Blocks\Form::forge()->setConfigs('delete-form', $this->url('admin/scaffold/{entity}/delete/{id}', ['entity' => $this->entity, 'id' => $this->id])); $cancelBtn = \Magelight\Webform\Blocks\Elements\Abstraction\Element::forge()->setTag('a')->setClass('btn btn-success')->setAttribute('href', $this->url('admin/scaffold/{entity}', ['entity' => $this->entity]))->setContent(__('Cancel')); $this->deleteForm->addContent(\Magelight\Webform\Blocks\Elements\InputHidden::forge()->setName('id')->setValue($this->id)); $this->deleteForm->addButtonsRow([\Magelight\Webform\Blocks\Elements\Button::forge()->setContent(__('Delete'))->setType('submit')->addClass('btn-warning'), $cancelBtn]); } return $this->deleteForm; }