public function handle($name, array $options, ClassMetadata $classMetadata, Configuration $configuration) { if ($name !== NULL) { return NULL; } return new FormBuilder($classMetadata, $this->formFactory->create(), $configuration); }
/** * @return Form */ public function createComponentForm() { $form = $this->formFactory->create(); $form->addText('email', 'E-mail')->setRequired(); $form->addPassword('password', 'Password')->setRequired(); $form->addSubmit('ok', 'Login'); $form->onSuccess[] = [$this, 'processLoginForm']; return $form; }
/** * @param null|object $entity entity * @param null|array $offset * @return Nette\Application\UI\Form|Forms\TFormWithMapper */ public function create($entity = NULL, $offset = NULL) { $form = $this->formFactory->create(); if (!$form instanceof Forms\IFormWithMapper) { throw new UnexpectedValueException('Librette\\Forms\\IFormWithMapper needed, instance of ' . get_class($form) . ' given'); } if ($entity) { $form->setMapper($this->createMapper($entity, $offset)); } return $form; }