public function __construct(EntityManager $entityManager) { parent::__construct('category'); $this->entityManager = $entityManager; $this->setHydrator(new DoctrineHydrator($entityManager, 'Blog\\Entity\\Category')); $this->add(array('name' => 'label', 'type' => 'Text', 'options' => array('label' => 'Nom de la catégorie'))); }
public function __construct() { parent::__construct('ProductVariantFieldset'); $this->setHydrator(new ClassMethodsHydrator(false))->setObject(new Category()); $this->setLabel('Product Variant'); $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'variant', 'attributes' => array('class' => 'form-control form-element'), 'options' => array('label' => 'Product Variant', 'label_attributes' => array('class' => 'media-object')))); }
public function __construct($academicperiodid, \Doctrine\ORM\EntityManager $em = null, $classid = null, $classmodule = null) { $this->em = $em; $this->classid = $classid; $this->academicperiodid = $academicperiodid; parent::__construct('Classmodule'); $this->setHydrator(new ClassMethodsHydrator(false))->setObject(new Classmodule()); if ($classmodule == NULL) { $this->add(array('name' => 'fkModuleid', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('class' => 'form-control', 'id' => 'fkModuleid'), 'options' => array('label' => 'Module:*', 'value_options' => $this->getAvailableModules(), 'empty_option' => "--Select module--"))); } else { $this->add(array('name' => 'fkModuleid', 'type' => 'Hidden')); } /* * Configure examweight field to form */ $this->add(array('name' => 'exweight', 'type' => 'Zend\\Form\\Element\\Number', 'attributes' => array('class' => 'form-control', 'id' => 'exweight'), 'options' => array('label' => 'Exam weight*:'))); /* * Configure id field to form */ $this->add(array('name' => 'pkClassmoduleid', 'type' => 'hidden')); /* * Configure academic period */ $this->add(array('name' => 'fkAcademicperiod', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('class' => 'form-control', 'id' => 'fkAcademicperiod'), 'options' => array('label' => 'Semester:*', 'value_options' => $this->getSemesters(), 'empty_option' => "--Select semester--"))); /* * Configure examweight field to form */ $this->add(array('name' => 'cwkweight', 'type' => 'Zend\\Form\\Element\\Number', 'attributes' => array('class' => 'form-control', 'id' => 'cwkweight'), 'options' => array('label' => 'Course work weight:*'))); $this->add(array('name' => 'fkClassid', 'type' => 'hidden')); $this->add(array('type' => 'Zend\\Form\\Element\\Radio', 'name' => 'isCore', 'options' => array('label' => 'Is core:*', 'value_options' => array("1" => "Yes", "0" => "No")))); $this->add(array('type' => 'Zend\\Form\\Element\\Radio', 'name' => 'isProject', 'options' => array('label' => 'Is project:*', 'value_options' => array("1" => "Yes", "0" => "No")))); }
public function __construct() { // we want to ignore the name passed parent::__construct('navigation_page_params'); $this->add(array('name' => 'param_name', 'attributes' => array('type' => 'text', 'placeholder' => 'Name', 'id' => 'param_name'), 'options' => array('label' => 'Name'))); $this->add(array('name' => 'param_value', 'attributes' => array('type' => 'text', 'placeholder' => 'Value', 'id' => 'param_value'), 'options' => array('label' => 'Value'))); }
public function __construct() { parent::__construct('category'); $this->setHydrator(new ArraySerializableHydrator())->setObject(new Category()); $this->setLabel('Category'); $this->add(array('name' => 'name', 'options' => array('label' => 'Name of the category'), 'attributes' => array())); }
public function __construct($name = null, $options = array()) { parent::__construct('tJurisdictionProduct', $options); /*if (null === $this->em) { var_dump('hid'); $this->em = $this->getFormFactory()->getFormElementManager()->getServiceLocator();//->get('doctrine.entitymanager.orm_default'); } var_dump($this->em); exit;*/ $this->setHydrator(new ClassMethodsHydrator(false))->setObject(new JurProductCustom()); for ($x = 1; $x <= 3; $x++) { $this->setLabel('CA'); $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eSubmissionDate' . $x, 'options' => array('label' => 'Submission (Estimated)'))); $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eApprovalDate' . $x, 'options' => array('label' => 'Approval (Estimated)'))); $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eReleaseDate' . $x, 'options' => array('label' => 'Master Release (Estimated)'))); $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eLaunchDate' . $x, 'options' => array('label' => 'Launch (Estimated)'))); $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eRegulatorDate' . $x, 'options' => array('label' => 'Regulator (Estimated)'))); // result $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rSubmissionDate' . $x, 'options' => array('label' => 'Submission (Result)'))); $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rApprovalDate' . $x, 'options' => array('label' => 'Approval (Result)'))); $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rReleaseDate' . $x, 'options' => array('label' => 'Master Release (Result)'))); $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rLaunchDate' . $x, 'options' => array('label' => 'Launch (Result)'))); $this->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rRegulatorDate' . $x, 'options' => array('label' => 'Regulator (Result)'))); } }
public function __construct() { parent::__construct('product'); $this->add(array('name' => 'id', 'attributes' => array('type' => 'text'), 'options' => array('label' => 'Product-ID:'))); $this->add(array('name' => 'name', 'attributes' => array('type' => 'text'), 'options' => array('label' => 'Product name'))); $this->add(array('name' => 'stock', 'attributes' => array('type' => 'number'), 'options' => array('label' => '# number'))); }
public function __construct() { parent::__construct('product'); $this->add(array('name' => 'productId', 'type' => 'Zend\\Form\\Element\\Text', 'options' => array('label' => 'ID товара:'))); $this->add(array('name' => 'name', 'type' => 'Zend\\Form\\Element\\Text', 'options' => array('label' => 'Название товара:'))); $this->add(array('name' => 'stock', 'type' => 'Zend\\Form\\Element\\Number', 'attributes' => array('step' => 1, 'min' => 0), 'options' => array('label' => 'Количество:'))); }
public function __construct(ObjectManager $obj, $questionType = ExamQuestion::QUESTION_TYPE_CLOSED, $numberOfAnswers = self::DEFAULT_NUMBER_OF_ANSWERS, $name = null, $options = []) { parent::__construct($name, $options); $this->questionType = $questionType; $this->setHydrator(new DoctrineHydrator($obj))->setObject(new ExamQuestion()); $this->add(array('name' => 'examQuestionEnunciation', 'type' => 'textarea', 'attributes' => array('rows' => 15, 'id' => 'question-enunciation'), 'options' => array('label' => 'Enunciado')))->add(array('name' => 'examQuestionType', 'type' => 'select', 'options' => array('label' => 'Tipo de questão', 'value_options' => array(['value' => ExamQuestion::QUESTION_TYPE_CLOSED, 'label' => ExamQuestion::QUESTION_TYPE_CLOSED_DESC, 'selected' => $questionType === ExamQuestion::QUESTION_TYPE_CLOSED], ['value' => ExamQuestion::QUESTION_TYPE_OPEN, 'label' => ExamQuestion::QUESTION_TYPE_OPEN_DESC, 'selected' => $questionType === ExamQuestion::QUESTION_TYPE_OPEN])), 'attributes' => array('id' => 'question-type')))->add(array('name' => 'subject', 'type' => 'select', 'options' => array('label' => 'Disciplina', 'value_options' => $this->getSubjects($obj)), 'attributes' => array('id' => 'subject')))->add(array('name' => 'answerOptions', 'type' => 'Zend\\Form\\Element\\Collection', 'options' => array('count' => $numberOfAnswers, 'should_create_template' => true, 'allow_add' => true, 'allow_remove' => true, 'template_placeholder' => '__placeholder__', 'target_element' => new ExamAnswerFieldset($obj, 'exam-answer'))))->add(array('type' => 'Zend\\Form\\Element\\Radio', 'name' => 'correctAnswer', 'options' => array('label' => 'Resposta Correta', 'value_options' => self::generateAnswers($numberOfAnswers), 'disable_inarray_validator' => true, 'inline' => true))); }
public function __construct(EntityManager $entityManager) { parent::__construct('filter-comment'); $this->entityManager = $entityManager; $this->setHydrator(new DoctrineHydrator($entityManager, 'Blog\\Entity\\Comment')); $this->add(array('type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'name' => 'post', 'options' => array('object_manager' => $entityManager, 'label' => 'Article', 'target_class' => 'Blog\\Entity\\Post', 'display_empty_item' => true, 'empty_item_label' => '', 'property' => 'title', 'is_method' => true, 'find_method' => array('name' => 'getOpenOrderByTitle')), 'allow_empty' => true, 'required' => false, 'attributes' => array('id' => 'post-list', 'multiple' => false))); }
public function __construct(ObjectManager $objectManager) { parent::__construct('section'); $this->setHydrator(new DoctrineHydrator($objectManager, 'Admin\\Entity\\Section'))->setObject(new Section()); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'name', 'attributes' => array('type' => 'text', 'placeholder' => 'Enter section name', 'class' => 'form-control', 'id' => 'name'), 'options' => array('label' => 'Name'), 'label_attributes' => array('class' => 'input'))); $this->add(array('name' => 'shortname', 'attributes' => array('type' => 'text', 'placeholder' => 'Short name', 'class' => 'form-control'), 'options' => array('label' => 'shortname'), 'label_attributes' => array('class' => 'input'))); //$objectManager->getRepository('OmniBlog\Form\CategoryPostAssociation')->findBy(array('post_id' => $this->po)) //$this->getEntityManager()->find('OmniBlog\Entity\Post', $id); //DoctrineModule\Form\Element\ObjectMultiCheckbox $xmy = new \DoctrineModule\Form\Element\ObjectMultiCheckbox(); //$subjectFieldset = new SubjectFieldset($objectManager); // $this->add(array( // 'type' => 'DoctrineModule\Form\Element\ObjectMultiCheckbox', // 'name' => 'subjects', /// 'options' => array( /// 'label' => 'Select Subjects', // 'object_manager' => $objectManager, // 'should_create_template' => true, // 'target_class' => 'Admin\Entity\Subject', /// 'property' => 'name', // 'target_element' => $subjectFieldset, // ), // )); $subjectFieldset = new SubjectFieldset($objectManager); $this->add(array('type' => 'DoctrineModule\\Form\\Element\\ObjectMultiCheckbox', 'name' => 'subject', 'options' => array('label' => 'Select Subjects', 'object_manager' => $objectManager, 'should_create_template' => true, 'target_class' => 'Admin\\Entity\\Subject', 'property' => 'code', 'target_element' => $subjectFieldset), 'label_attributes' => array('class' => 'checkbox'))); }
public function __construct() { parent::__construct('productSelector'); $this->setHydrator(new \Zend\Stdlib\Hydrator\Reflection()); $this->setObject(new \ZfDeals\Entity\Product()); $this->add(array('name' => 'id', 'type' => 'Zend\\Form\\Element\\Select', 'options' => array('label' => 'Produkt-ID:', 'value_options' => array('1' => 'Label 1', '2' => 'Label 2')))); }
/** * @param EntityManager $entityManager * @param Entity\EntityAbstract $object */ public function __construct(EntityManager $entityManager, Entity\EntityAbstract $object) { parent::__construct($object->get('underscore_entity_name')); $doctrineHydrator = new DoctrineHydrator($entityManager); $this->setHydrator($doctrineHydrator)->setObject($object); $builder = new AnnotationBuilder(); /** * Go over the different form elements and add them to the form */ foreach ($builder->createForm($object)->getElements() as $element) { /** * Go over each element to add the objectManager to the EntitySelect */ if ($element instanceof EntitySelect || $element instanceof EntityMultiCheckbox) { $element->setOptions(array_merge_recursive($element->getOptions(), ['object_manager' => $entityManager])); } if ($element instanceof Radio) { $attributes = $element->getAttributes(); $valueOptionsArray = 'get' . ucfirst($attributes['array']); $element->setOptions(array_merge_recursive($element->getOptions(), ['value_options' => $object->{$valueOptionsArray}()])); } //Add only when a type is provided if (array_key_exists('type', $element->getAttributes())) { $this->add($element); } } $this->add(['type' => '\\Zend\\Form\\Element\\Select', 'name' => 'organisation', 'options' => ['disable_inarray_validator' => true, "label" => _("txt-organisation"), "help-block" => _("txt-organisation-help-block")]]); $this->add(['type' => '\\Zend\\Form\\Element\\Text', 'name' => 'branch', 'options' => ["label" => _("txt-branch"), "help-block" => _("txt-branch-help-block")]]); }
public function __construct($name = "", $options = array()) { if ($name == "") { $name = 'UserProfileFieldset'; } parent::__construct($name, $options); }
public function __construct() { parent::__construct('content'); $this->setHydrator(new ClassMethodsHydrator(false))->setObject(new CategoryContent()); $this->add(array('name' => 'alias', 'options' => array('label' => 'Alias'), 'attributes' => array('maxlength' => $this->maxAliasLength))); $this->add(array('name' => 'title', 'options' => array('label' => 'Name'), 'attributes' => array('maxlength' => $this->maxTitleLength))); }
public function __construct(ObjectManager $objectManager) { parent::__construct('person'); $this->setAttribute('method', 'post'); $this->setHydrator(new DoctrineHydrator($objectManager))->setObject(new Person()); $this->add(array('type' => 'Zend\\Form\\Element\\Hidden', 'name' => 'id')); $this->add(array('name' => 'fname', 'attributes' => array('type' => 'text', 'placeholder' => 'First Name', 'class' => 'form-control', 'id' => 'fname', 'required' => true), 'options' => array('label' => 'name'), 'label_attributes' => array('class' => 'input'))); $this->add(array('name' => 'lname', 'attributes' => array('type' => 'text', 'placeholder' => 'Last Name', 'class' => 'form-control', 'id' => 'lname', 'required' => true), 'options' => array('label' => 'Last Name'), 'label_attributes' => array('class' => 'input'))); $this->add(array('name' => 'mname', 'attributes' => array('type' => 'text', 'placeholder' => 'Middle Name', 'class' => 'form-control', 'id' => 'mname'), 'options' => array('label' => 'Middle Name'), 'label_attributes' => array('class' => 'input'))); $this->add(array('name' => 'dob', 'attributes' => array('type' => 'Zend\\Form\\Element\\Text', 'placeholder' => 'Date of Birth', 'class' => 'datepicker', 'id' => 'dob', 'format' => 'd/m/Y', 'required' => true, 'data-dateformat' => "dd/mm/yy"), 'options' => array('label' => 'Date of birth'), 'label_attributes' => array())); $this->add(array('name' => 'religion', 'type' => 'Zend\\Form\\Element\\Select', 'options' => array('label' => 'religion', 'empty_option' => 'Select Your Religion', 'value_options' => array('Christianity' => 'Christianity', 'Islam' => 'Islam', 'Traditional' => 'Traditional', 'Others' => 'Others')), 'attributes' => array('required' => true, 'class' => 'select2', 'id' => 'religion'))); $this->add(array('name' => 'mobile', 'attributes' => array('type' => 'Zend\\Form\\Element\\Text', 'placeholder' => 'Enter your mobile', 'class' => '', 'id' => 'mobile', 'data-mask' => "+234 (803) 247-8284", 'data-mask-placeholder' => "X"), 'options' => array('label' => 'Mobile Number'), 'label_attributes' => array('class' => 'input'))); $this->add(array('name' => 'nokRel', 'attributes' => array('type' => 'text', 'placeholder' => 'Next-Of-Kin Relationship', 'class' => 'form-control', 'id' => 'nokRel', 'required' => true), 'options' => array('label' => 'Next-Of-Kin Relationship'), 'label_attributes' => array('class' => 'input'))); $this->add(array('name' => 'nokName', 'attributes' => array('type' => 'text', 'placeholder' => 'Full Name of Next-Of-Kin', 'class' => 'form-control', 'id' => 'nokName', 'required' => true), 'options' => array('label' => 'Name of Next-Of-Kin'), 'label_attributes' => array('class' => 'input'))); $this->add(array('name' => 'nokMobile', 'attributes' => array('type' => 'text', 'placeholder' => 'Next-Of-Kin Mobile ', 'class' => 'form-control', 'id' => 'nokMobile', 'required' => true), 'options' => array('label' => 'Mobile of Next-Of-Kin'), 'label_attributes' => array('class' => 'input'))); $this->add(array('name' => 'sex', 'type' => 'Zend\\Form\\Element\\Select', 'options' => array('label' => 'Sex', 'empty_option' => 'Select your gender', 'value_options' => array('Male' => 'Male', 'Female' => 'Female')), 'attributes' => array('required' => true, 'class' => 'select2'))); $this->add(array('name' => 'country', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'options' => array('label' => 'Country', 'object_manager' => $objectManager, 'target_class' => 'Admin\\Entity\\Country', 'property' => 'name', 'empty_option' => 'Choose your country'), 'attributes' => array('required' => true, 'class' => 'select2'))); $this->add(array('name' => 'state', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'options' => array('label' => 'State', 'object_manager' => $objectManager, 'target_class' => 'Admin\\Entity\\State', 'property' => 'name', 'empty_option' => 'Choose your state', 'option_attributes' => array('data-id' => function (\Admin\Entity\State $entity) { return $entity->getId(); })), 'attributes' => array('required' => true, 'class' => 'select2', 'id' => 'state'))); $this->add(array('type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'name' => 'lga', 'options' => array('object_manager' => $objectManager, 'target_class' => 'Admin\\Entity\\Lga', 'property' => 'name', 'empty_option' => 'Choose your L.G.A', 'option_attributes' => array('data-id' => function (\Admin\Entity\Lga $entity) { return $entity->getState()->getId(); })), 'attributes' => array('required' => true, 'class' => 'select2', 'id' => 'lga'))); $this->add(array('name' => 'address', 'attributes' => array('type' => 'Zend\\Form\\Element\\Textarea', 'placeholder' => 'Address', 'class' => 'form-control', 'required' => true), 'options' => array('label' => 'Address'), 'label_attributes' => array('class' => 'input'))); $GuardianFieldset = new GuardianFieldset($objectManager); $this->add($GuardianFieldset); }
public function __construct() { parent::__construct('nested_fieldset'); $field = new Element('anotherField', array('label' => 'Name')); $field->setAttribute('type', 'text'); $this->add($field); }
public function __construct() { parent::__construct('modext'); $this->add(array('name' => 'twitter', 'type' => 'Text', 'options' => array('label' => 'Twitter'))); $this->add(array('name' => 'github', 'type' => 'Text', 'options' => array('label' => 'GitHub'))); $this->add(array('name' => 'homepage', 'type' => 'Url', 'options' => array('label' => 'Homepage'))); }
public function __construct() { parent::__construct('lead'); $this->setHydrator(new ClassMethodsHydrator(false))->setObject(new Lead()); $this->_fieldNames = self::getFieldNames(); foreach ($this->_fieldNames as $label => $fieldName) { switch ($fieldName) { case 'id': case 'driverid': case 'formid': case 'submitted': $this->add(array('options' => array('label' => $label, 'label_attributes' => array('class' => 'sr-only')), 'type' => 'hidden', 'allow_empty' => true, 'name' => $fieldName)); break; case 'timecreated': $this->add(array('options' => array('label' => $label, 'format' => 'Y-m-d\\TH:i'), 'type' => '\\Zend\\Form\\Element\\DateTimeLocal', 'name' => $fieldName)); break; case 'timesubmitted': $this->add(array('options' => array('label' => $label, 'format' => 'Y-m-d\\TH:i'), 'type' => '\\Zend\\Form\\Element\\DateTimeLocal', 'allow_empty' => true, 'name' => $fieldName)); break; case 'referrer': $this->add(array('options' => array('label' => $label), 'type' => '\\Zend\\Form\\Element\\Url', 'name' => $fieldName)); break; case 'lastresponse': $this->add(array('options' => array('label' => $label), 'type' => 'textarea', 'name' => $fieldName)); break; default: $this->add(array('options' => array('label' => $label), 'type' => 'text', 'name' => $fieldName)); break; } } }
public function __construct(ServiceManager $serviceManager) { parent::__construct('hobby'); $entityManager = $serviceManager->get('Doctrine\\ORM\\EntityManager'); $this->setHydrator(new DoctrineHydrator($entityManager, 'Blog\\Entity\\Hobby'))->setObject(new Hobby()); $this->add(array('type' => 'text', 'name' => 'name', 'options' => array('label' => 'Hobby'))); }
/** * @param ObjectManager $objectManager * @param Scope $clientPrototype * @param null $name * @param array $options */ public function __construct(ObjectManager $objectManager, Scope $clientPrototype, $name = null, $options = []) { parent::__construct($name, $options); $this->objectManager = $objectManager; $this->setHydrator(new DoctrineObject($objectManager)); $this->setObject($clientPrototype); }
public function __construct(ObjectManager $objectManager) { parent::__construct('term'); $this->setHydrator(new DoctrineHydrator($objectManager, 'Admin\\Entity\\Term'))->setObject(new Term()); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'termName', 'attributes' => array('type' => 'text', 'placeholder' => 'Term name', 'class' => 'form-control'), 'options' => array('label' => 'Term Name'), 'label_attributes' => array('class' => 'input'))); }
public function __construct($sm) { parent::__construct('resetPassword'); $this->sm = $sm; $altesPasswort = new Password('oldPass'); $altesPasswort->setLabel('LABEL_CHANGE_PASSWORD_OLD_PASS'); $altesPasswort->setLabelAttributes(array('class' => 'col-sm-2 control-label')); $altesPasswort->setAttribute('class', 'form-control'); $altesPasswort->setAttribute('id', 'oldPass'); $this->add($altesPasswort); $neuesPasswort = new Password('newPass'); $neuesPasswort->setLabel('LABEL_CHANGE_PASSWORD_NEW_PASS'); $neuesPasswort->setLabelAttributes(array('class' => 'col-sm-2 control-label')); $neuesPasswort->setAttribute('class', 'form-control'); $neuesPasswort->setAttribute('id', 'newPass'); $this->add($neuesPasswort); $neuesPasswortConfirm = new Password('newPassConfirm'); $neuesPasswortConfirm->setLabel('LABEL_CHANGE_PASSWORD_NEW_CONFIRM'); $neuesPasswortConfirm->setLabelAttributes(array('class' => 'col-sm-2 control-label')); $neuesPasswortConfirm->setAttribute('class', 'form-control'); $neuesPasswortConfirm->setAttribute('id', 'newPassConfirm'); $this->add($neuesPasswortConfirm); $submit = new Submit('resetPasswordSubmit'); $submit->setValue('LABEL_CHANGE_PASSWORD_SUBMIT'); $submit->setAttribute('class', 'btn btn-default'); $this->add($submit); return $this; }
public function __construct($name = "", $options = array()) { if ($name == "") { $name = 'SiteEmailOptionsFieldset'; } parent::__construct($name, $options); }
public function __construct(array $options = []) { parent::__construct('foo-fieldset', $options); $this->add(['type' => Text::class, 'name' => 'fooText', 'options' => ['label' => 'Some Text Element']]); $this->add(['type' => Select::class, 'name' => 'fooSelect', 'options' => ['label' => 'Some Select Element', 'value_options' => ['foo' => 'Foo', 'bar' => 'Bar'], 'empty_option' => '--- Foo or Bar? ---']]); $this->add(['type' => Collection::class, 'name' => 'barCollection', 'options' => ['label' => 'A Bar', 'count' => 2, 'should_create_template' => true, 'allow_add' => true, 'template_placeholder' => '__bar__', 'target_element' => ['type' => BarFieldset::class]]]); }
public function __construct(ObjectManager $objectManager) { parent::__construct('category'); $this->setHydrator(new DoctrineHydrator($objectManager, 'TinyBlog\\Entity\\Category', true))->setObject(new Category()); $this->add(array('type' => 'Zend\\Form\\Element\\Hidden', 'name' => 'id')); $this->add(array('type' => 'Zend\\Form\\Element\\Text', 'name' => 'name', 'options' => array('label' => 'Category'))); }
/** * @param EntityManager $entityManager * @param Entity\EntityAbstract $object */ public function __construct(EntityManager $entityManager, Entity\EntityAbstract $object) { parent::__construct($object->get('underscore_entity_name')); $doctrineHydrator = new DoctrineHydrator($entityManager); $this->setHydrator($doctrineHydrator)->setObject($object); $builder = new AnnotationBuilder(); /** * Go over the different form elements and add them to the form */ foreach ($builder->createForm($object)->getElements() as $element) { /** * Go over each element to add the objectManager to the EntitySelect */ if ($element instanceof EntitySelect || $element instanceof EntityMultiCheckbox) { $element->setOptions(array_merge_recursive($element->getOptions(), ['object_manager' => $entityManager])); } if ($element instanceof Radio) { $attributes = $element->getAttributes(); $valueOptionsArray = 'get' . ucfirst($attributes['array']); $element->setOptions(array_merge_recursive($element->getOptions(), ['value_options' => $object->{$valueOptionsArray}()])); } //Add only when a type is provided if (array_key_exists('type', $element->getAttributes())) { $this->add($element); } } }
public function __construct() { parent::__construct('category'); $this->setHydrator(new ClassMethodsHydrator(false))->setObject(new Category()); $this->setLabel('Category'); $this->add(array('name' => 'eSubmissionDate', 'options' => array('label' => 'eSubmissionDate'), 'attributes' => array('required' => 'required'))); }
/** * @param EntityManager $entityManager */ public function __construct(EntityManager $entityManager) { parent::__construct('doa'); $doa = new Entity\Doa(); $doctrineHydrator = new DoctrineHydrator($entityManager, 'Affiliation\\Entity\\Doa'); $this->setHydrator($doctrineHydrator)->setObject($doa); $builder = new AnnotationBuilder(); /** * Go over the different form elements and add them to the form */ foreach ($builder->createForm($doa)->getElements() as $element) { /** * Go over each element to add the objectManager to the EntitySelect */ if ($element instanceof EntitySelect) { $element->setOptions(['object_manager' => $entityManager]); } //Add only when a type is provided if (array_key_exists('type', $element->getAttributes())) { $this->add($element); } } $this->add(['type' => '\\Zend\\Form\\Element\\Select', 'name' => 'contact', 'options' => ["label" => "txt-signer"]]); $this->add(['type' => '\\Zend\\Form\\Element\\File', 'name' => 'file', 'options' => ["label" => "txt-source-file", "help-block" => _("txt-attachment-requirements")]]); }
public function init() { parent::__construct('Item'); $this->setObject(new Item()); //$this->entityManager = $entityManager; $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'Name', 'options' => array('label' => 'Name of the product'), 'attributes' => array('required' => 'required'))); $this->add(array('name' => 'Description', 'options' => array('label' => 'Description of the product'), 'attributes' => array('required' => 'required'))); $this->add(array('name' => 'Price', 'options' => array('label' => 'Price of the product'), 'attributes' => array('required' => 'required'))); $this->add(array('name' => 'Pice', 'options' => array('label' => 'Pices of the product'), 'attributes' => array('required' => 'required'))); //zmienic na pole plikowe !!!!!!!!!!!!!!!!!!! $this->add(array('name' => 'Image', 'options' => array('label' => 'Image of the product'), 'attributes' => array('required' => 'required'))); $this->add(array('type' => 'Zend\\Form\\Element\\Collection', 'name' => 'Category', 'options' => array('label' => 'Please choose categories for this product', 'count' => 1, 'should_create_template' => true, 'allow_add' => true, 'target_element' => array('type' => 'Sklep\\Form\\CategoryFieldset')))); /* $this->add(array( 'type' => 'DoctrineModule\Form\Element\ObjectSelect', 'name' => 'Category', 'options' => array( 'options' => array( 'object_manager' => $em, 'target_class' => 'Sklep\Entity\Category', 'property' => 'Category', ), ), )); */ $this->add(array('type' => 'Sklep\\Form\\CategoryFieldset', 'options' => array('use_as_base_fieldset' => true))); }