/**
  * @return FormComponent
  */
 protected function createComponentForm()
 {
     $builder = $this->formFactory->createNamedBuilder($this->lookupPath('Nette\\Application\\UI\\Presenter'), $this->type, $this->entity, $this->options);
     $component = $this->formComponentFactory->create($builder->getForm());
     if ($this->theme) {
         $component->onCreateView[] = function ($view, $component) {
             $component->getRenderer()->setTheme($view, $this->theme);
         };
     }
     $component->onSuccess[] = function ($entity) {
         $this->processForm($entity);
     };
     return $component;
 }
 /**
  * @return FormComponent
  */
 protected function createComponentForm()
 {
     $builder = $this->formFactory->createNamedBuilder($this->lookupPath('Nette\\Application\\UI\\Presenter'), 'form', null, []);
     $builder->add('firstname');
     $builder->add('lastname');
     $builder->add('email');
     $builder->add('text');
     $component = $this->formComponentFactory->create($builder->getForm());
     $component->onSuccess[] = function (array $data) {
         // process data
         $this->getPresenter()->flashMessage('The form has been sucessfully sent.');
         $this->getPresenter()->redirect('this');
     };
     return $component;
 }