public function setup()
 {
     $this->addText('title')->setRequired('title.missing');
     $this->addText('description')->setRequired('description.missing');
     $this->addEditorSelector('editors', $this->orm, $this->user->isAllowed(Acl::ALL));
     $this->addHidden('positions');
     $this->addSubmit();
 }
 public function setup()
 {
     $user = $this->userState->getUserEntity();
     $this->addText('password')->addRule($this::FILLED, 'password.missing');
     $this->addHidden('name')->setDefaultValue($user->name)->setDisabled();
     $this->addHidden('email')->setDefaultValue($user->email)->setDisabled();
     $this->addSubmit();
 }
 public function onSuccess()
 {
     $v = $this->values;
     $user = $this->user->getUserEntity();
     $user->setNames($v->name);
     $unsubscribe = $this->orm->unsubscribes->getByEmail($user->email);
     if ($v->subscribe) {
         if ($unsubscribe) {
             $this->orm->unsubscribes->remove($unsubscribe);
         }
     } else {
         if (!$unsubscribe) {
             $unsubscribe = new Unsubscribe($user->email, 'manual-settings');
             $this->orm->unsubscribes->attach($unsubscribe);
         }
     }
     $this->orm->flush();
     $this->presenter->flashSuccess('profileForm.success');
     $this->presenter->redirect('this');
 }