/** * 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; }
/** * 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; }
/** * Set form validation. * * @param FieldSet $content Content object. * * @return void */ protected function _setValidation($content) { $content->setRequired('title'); }
/** * 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])); }
/** * 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()); }
/** * 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]]); }
/** * 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); } } }
/** * 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); }