コード例 #1
0
 /**
  * @param Form $form
  */
 protected function configure(Form $form)
 {
     $group = $form->addGroup('Registration');
     $userTypes = array();
     foreach ($this->securityManager->getUserTypes() as $name => $val) {
         $userTypes[$name] = $val->getName();
     }
     $registrations = $form->addDynamic('registrations', function (Container $registration) use($form, $group, $userTypes) {
         $group = $form->addGroup('Registration');
         $registration->setCurrentGroup($group);
         $registration->addCheckbox('enabled', 'Enabled')->addCondition($form::EQUAL, TRUE)->toggle('reg-' . $registration->name);
         $registration->setCurrentGroup($registration->form->addGroup()->setOption('id', 'reg-' . $registration->name));
         $registration->addText('name', 'Name');
         $registration->addSelect('userType', 'Type', $userTypes);
         $registration->addSelect('mode', 'Mode', PageEntity::getModes())->addCondition($form::IS_IN, array(PageEntity::MODE_MAIL, PageEntity::MODE_MAIL_CHECKUP))->toggle('email-' . $registration->name);
         $registration->addSelect('loginProviderMode', 'Login provider mode', PageEntity::getSocialModes());
         $registration->addMultiSelect('roles', 'Roles', $this->getRoles());
         $email = $registration->addContainer('email');
         $email->setCurrentGroup($form->addGroup()->setOption('id', 'email-' . $registration->name));
         $email->addText('subject', 'Subject');
         $email->addText('sender', 'Sender');
         $email->addText('from', 'From');
         $email->addTextArea('text', 'Text');
         $registration->addSubmit('_remove', 'Remove')->addRemoveOnClick();
     }, 1);
     $registrations->setCurrentGroup($group);
     $registrations->addSubmit('_add', 'Add')->addCreateOnClick();
     $form->setCurrentGroup();
     $form->addSaveButton('Save');
 }
コード例 #2
0
 /**
  * @param Form $form
  */
 public function configure(Form $form)
 {
     $form->addGroup('Settings');
     $form->addSelect('mode', 'Registration mode', PageEntity::getModes())->addCondition($form::IS_IN, array(PageEntity::MODE_MAIL, PageEntity::MODE_MAIL_CHECKUP))->toggle('form-group-email');
     $form->addSelect('socialMode', 'Login provider mode', PageEntity::getSocialModes());
     $form->addSelect('userType', 'User type', $this->getUserTypes());
     $form->addManyToMany('roles', 'Roles for new user');
     $form->addGroup('E-mail')->setOption('id', 'form-group-email');
     $form->addText('mailFrom', 'From')->addConditionOn($form['mode'], $form::IS_IN, array(PageEntity::MODE_MAIL, PageEntity::MODE_MAIL_CHECKUP))->addRule($form::EMAIL);
     $form->addText('sender', 'Sender');
     $form->addText('subject', 'Subject');
     $form->addEditor('email', 'E-mail body');
     $form->setCurrentGroup();
     $form->addSaveButton('Save');
 }