Example #1
0
 /**
  * Add fieldset.
  *
  * @param Form\FieldSet $fieldSet FieldSet object.
  * @param int|null      $order    FieldSet order.
  *
  * @return $this
  */
 public function addFieldSet(Form\FieldSet $fieldSet, $order = null)
 {
     if (!$order) {
         $order = $this->_currentOrder++;
     }
     $this->_fieldSets[$order] = $fieldSet;
     $this->_order[$fieldSet->getName()] = $order;
     return $this;
 }
Example #2
0
 /**
  * Add footer fieldset.
  *
  * @param bool $combined Combine elements?
  *
  * @return FieldSet
  */
 public function addFooterFieldSet($combined = true)
 {
     $fieldSet = new FieldSet(self::FIELDSET_FOOTER, null, ['class' => self::FIELDSET_FOOTER]);
     $fieldSet->combineElements($combined);
     $this->addFieldSet($fieldSet);
     return $fieldSet;
 }
Example #3
0
 /**
  * Set form validation.
  *
  * @param FieldSet $content Content object.
  *
  * @return void
  */
 protected function _setValidation($content)
 {
     $content->setRequired('title');
 }
Example #4
0
 /**
  * Set form validation.
  *
  * @param CoreForm|FieldSet $content Container object.
  *
  * @return void
  */
 protected function _setValidation($content)
 {
     $content->setRequired('username')->setRequired('email')->setRequired('password')->setRequired('repeatPassword')->getValidation()->add('username', new StringLength(['min' => 2]))->add('email', new Email())->add('password', new StringLength(['min' => 6]))->add('repeatPassword', new StringLength(['min' => 6]));
 }
Example #5
0
 /**
  * Set form validation.
  *
  * @param FieldSet $content Content fieldset.
  *
  * @return void
  */
 protected function _setValidation($content)
 {
     $content->getValidation()->add('email', new Email())->add('username', new PresenceOf())->add('password', new PresenceOf());
 }
Example #6
0
 /**
  * Set form validation.
  *
  * @param FieldSet $content Content object.
  *
  * @return void
  */
 protected function _setValidation($content)
 {
     $content->setRequired('language')->setRequired('locale');
     $content->getValidation()->add('language', new StringLength(['min' => 2, 'max' => 2]))->add('locale', new StringLength(['min' => 5, 'max' => 5]));
     $this->setImageTransformation('icon', ['adapter' => 'GD', 'resize' => [32, 32]]);
 }
Example #7
0
 /**
  * Set ignored option.
  *
  * @param Form|FieldSet $container Container object.
  * @param bool          $flag      Ignore flag.
  *
  * @return void
  */
 protected function _setIgnored($container, $flag)
 {
     foreach ($container->getAll() as $element) {
         if ($element instanceof FieldSet) {
             $this->_setIgnored($element, $flag);
         } else {
             $element->setOption('ignore', $flag);
         }
     }
 }
Example #8
0
 /**
  * Set form validation.
  *
  * @param FieldSet $content Fieldset object.
  *
  * @return void
  */
 protected function _setValidation($content)
 {
     $content->getValidation()->add('username', new StringLength(['min' => 2]))->add('email', new Email())->add('password', new StringLength(['min' => 6]))->add('repeatPassword', new StringLength(['min' => 6]));
     $content->setRequired('username')->setRequired('email')->setRequired('password')->setRequired('repeatPassword');
     $this->addFilter('password', self::FILTER_STRING)->addFilter('repeatPassword', self::FILTER_STRING);
 }