public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $units = $options['units'];
     // Options Headings
     $headings = [];
     foreach ($units as $unit) {
         foreach ($unit->options as $name => $value) {
             $headings[$name] = ucfirst($name);
         }
     }
     foreach ($units as $unit) {
         // If a unit has no options, it is broken so we should ignore it
         if (count($unit->options) <= 0) {
             continue;
         }
         $unitForm = $builder->create($unit->id, 'form');
         $unitForm->add('sku', 'text', ['label' => false, 'data' => $unit->sku, 'attr' => ['placeholder' => 'ms.commerce.product.units.sku.placeholder']]);
         // Create options form
         $optionsForm = $builder->create('options', 'form');
         foreach ($headings as $type => $displayName) {
             $choices = [];
             foreach ($this->_optionLoader->getByName($type) as $choice) {
                 $choice = trim($choice);
                 $choices[$choice] = $choice;
             }
             $fieldName = preg_replace('/[^a-z0-9]/i', '_', $type);
             $optionsForm->add($fieldName, 'datalist', ['data' => !empty($unit->options[$type]) ? $unit->options[$type] : null, 'choices' => $choices]);
         }
         $unitForm->add($optionsForm);
         $unitForm->add('prices', 'price_form', ['priced_entity' => $unit]);
         $unitForm->add('weight', 'text', ['data' => $unit->weight !== $unit->getProduct()->weight ? $unit->weight : null, 'attr' => ['data-help-key' => 'ms.commerce.product.details.weight-grams.help']]);
         $unitForm->add('visible', 'checkbox', ['data' => $unit->visible, 'attr' => ['data-help-key' => 'ms.commerce.product.units.visible.help']]);
         $builder->add($unitForm);
     }
 }
示例#2
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $object = $builder->getData();
     $tagTransformer = new TagsToTextTransformer($this->entityManager->getManager(), $this->taxonomyClass);
     $photoTransformer = new PhotoToIdTransformer($this->entityManager->getManager());
     $builder->add('title', 'text', array('required' => true, 'label' => 'Title:', 'attr' => array('class' => 'form-control form-control--lg margin--b', 'placeholder' => 'Enter title of the article')))->add('excerpt', 'textarea', array('required' => false, 'label' => 'Excerpt text:', 'attr' => array('class' => 'form-control form-control--lg margin--halfb', 'rows' => 2, 'placeholder' => 'Enter excerpt text')))->add($builder->create('excerptPhoto', 'hidden', array('attr' => array('class' => 'sr-only js-excerpt-photo'), 'required' => false))->addModelTransformer($photoTransformer))->add('content', 'textarea', array('required' => false, 'label' => ' ', 'attr' => array('class' => 'tinymce hide')))->add('categories', 'entity', array('class' => $this->taxonomyClass, 'required' => false, 'expanded' => true, 'multiple' => true, 'attr' => array('class' => 'js-get-pretty-categories', 'placeholder' => 'Select category')))->add($builder->create('tags', 'text', array('required' => false, 'attr' => array("class" => "form-control form-control--lg margin--halfb", "placeholder" => "Enter tags", "data-role" => "tagsinput")))->addModelTransformer($tagTransformer))->add('metaData', 'collection', array('type' => 'article_meta', 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false))->add('metaExtras', 'hidden', array('mapped' => false));
     if ($this->authorizationChecker->isGranted('SWITCH_ARTICLE_AUTHOR')) {
         $builder->add('author', 'entity', array('label' => 'Author:', 'required' => true, 'class' => $this->userClass, 'placeholder' => 'Select author', 'query_builder' => function (EntityRepository $er) {
             return $er->createQueryBuilder('a')->where('a.roles like :type')->orderBy('a.username', 'ASC')->setParameter('type', '%ROLE_BLOG_USER%');
         }, 'attr' => array('class' => 'form-control form-control--lg color-placeholder')));
     }
     if ($this->authorizationChecker->isGranted('EDIT_PUBLISH_STATUS', $object)) {
         $builder->add('status', 'choice', array('label' => 'Status:', 'choices' => array(Article::STATUS_PUBLISHED => "Published", Article::STATUS_DRAFTED => "Draft"), 'required' => true, 'attr' => array("class" => "form-control form-control--lg margin--halfb"), 'data' => $object->getParent() ? $object->getParent()->getStatus() : Article::STATUS_DRAFTED));
     }
     if (!$object->getParent()) {
         //When creating new articles
         if ($this->authorizationChecker->isGranted('PUBLISH_ARTICLE', $object)) {
             $builder->add('publish', 'submit', array('attr' => array('class' => 'btn btn-md btn-primary btn-wide--xl flright--responsive-mob margin--b first-in-line js-publish-article')));
         }
         $builder->add('save_draft', 'submit', array('attr' => array('class' => 'btn btn-md btn-b-blue btn-wide--xl flright--responsive-mob margin--r')));
     } else {
         if ($object && $object->getParent() && $object->getParent()->getStatus() == Article::STATUS_DRAFTED) {
             $builder->add('save', 'submit', array('attr' => array('class' => 'btn btn-md btn-b-blue btn-wide--xl flright--responsive-mob margin--r')));
             if ($this->authorizationChecker->isGranted('PUBLISH_ARTICLE', $object)) {
                 $builder->add('publish', 'submit', array('attr' => array('class' => 'btn btn-md btn-primary btn-wide--xl flright--responsive-mob margin--b first-in-line js-publish-article')));
             }
         } else {
             $builder->add('update', 'submit', array('attr' => array('class' => 'btn btn-md btn-primary btn-wide--xl flright--responsive-mob margin--r')));
         }
     }
 }
示例#3
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     // assuming $entityManager is passed in options
     $em = $options['em'];
     $transformer = new OrganisationunitToIdTransformer($em);
     $builder->add($builder->create('organisationunit', 'hidden', array('constraints' => array(new NotBlank())))->addModelTransformer($transformer))->add($builder->create('organisationunitToMove', 'hidden', array('required' => true, 'constraints' => array(new NotBlank())))->addModelTransformer($transformer))->add($builder->create('parentOrganisationunit', 'hidden', array('required' => true, 'constraints' => array(new NotBlank())))->addModelTransformer($transformer))->add('submit', 'submit');
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add($builder->create('dtAcaoInicio', 'text', array('label' => '', 'required' => false))->addModelTransformer(new CxDatePtBrTransformer()));
     $builder->add($builder->create('dtAcaoFim', 'text', array('label' => '', 'required' => false))->addModelTransformer(new CxDatePtBrTransformer()));
     $builder->add('idLocal', 'entity', array('class' => 'CacicCommonBundle:Local', 'property' => 'sgLocal', 'multiple' => true, 'required' => true, 'expanded' => true, 'label' => 'Selecione o Local:'));
     $builder->add('usuario', null, array('label' => '', 'max_length' => 30, 'required' => true));
 }
示例#5
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     // Fix, so the url gets parsed thought twig
     $twig = clone $this->app['twig'];
     $twig->setLoader(new \Twig_Loader_String());
     // Participant
     /*
      * Show only the first time until the visitor isn't a participant yet.
      * Each time afer that, the participant will automaticall be "attached"
      * to the entry.
      */
     if (!$this->app['participant']) {
         $nameData = null;
         $emailData = null;
         if ($this->app['facebookUser']) {
             $nameData = isset($this->app['facebookUser']->name) ? $this->app['facebookUser']->name : null;
             $emailData = isset($this->app['facebookUser']->email) ? $this->app['facebookUser']->email : null;
         }
         $builder->add($builder->create('participant', 'form', array('label' => false, 'by_reference' => true, 'data_class' => 'Application\\Entity\\ParticipantEntity'))->add('name', 'text', array('data' => $nameData))->add('email', 'email', array('data' => $emailData)));
     }
     // Entry
     $builder->add($builder->create('entry', 'form', array('label' => false, 'by_reference' => true, 'data_class' => 'Application\\Entity\\EntryEntity'))->add($builder->create('metas', 'form', array('label' => false))->add('answer', 'text', array('label' => 'What is the meaning of life?'))->add('me_and_the_hulk_image', 'file', array('label' => 'An image of yourself an the Hulk!', 'constraints' => array(new \Symfony\Component\Validator\Constraints\Image())))));
     $builder->add('terms', 'checkbox', array('label' => $twig->render('You agree with our <a href="{{ url(\'application.terms\') }}" target="_blank">Terms</a>'), 'required' => true));
     $builder->add('submit', 'submit', array('label' => 'Submit', 'attr' => array('class' => 'btn-primary btn-lg btn-block')));
 }
示例#6
0
 /**
  * Builds a form with given fields.
  *
  * @param object  $builder A Formbuilder interface object
  * @param array   $options An array of options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $entityManager = $options['em'];
     $transformer = new UserIdToObjectTransformer($entityManager);
     $userAcOptions = array();
     // Disable employee form if access is not granted
     // Currently access is only granted for ROLE_ADMIN.
     if ($options['data']->getUser() instanceof \Opit\OpitHrm\UserBundle\Entity\User) {
         if (false === $this->isGranted) {
             $userAcOptions['disabled'] = true;
         }
     }
     $builder->add($builder->create('user', 'hidden')->addModelTransformer($transformer));
     $builder->add('user_ac', 'text', array_merge(array('label' => 'Employee name', 'data' => ($user = $options['data']->getUser()) ? $user->getEmployee()->getEmployeeNameFormatted() : null, 'mapped' => false, 'attr' => array('placeholder' => 'Employee name', 'class' => 'width-300')), $userAcOptions));
     $builder->add('departure_date', 'date', array('widget' => 'single_text', 'label' => 'Departure date', 'attr' => array('placeholder' => 'Departure date')));
     $builder->add('arrival_date', 'date', array('widget' => 'single_text', 'label' => 'Arrival date', 'attr' => array('placeholder' => 'Arrival date')));
     $builder->add('customer_related', 'choice', array('required' => false, 'empty_value' => false, 'data' => 'No', 'label' => 'Customer related', 'choices' => array('1' => 'No', '0' => 'Yes')));
     $builder->add('customer_name', 'text', array('label' => 'Customer name', 'required' => false, 'attr' => array('placeholder' => 'Customer name')));
     $builder->add('trip_purpose', 'text', array('label' => 'Trip purpose', 'attr' => array('placeholder' => 'Trip purpose', 'class' => 'width-300')));
     $builder->add('destinations', 'collection', array('type' => new DestinationType(), 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false));
     $builder->add('accomodations', 'collection', array('type' => new AccomodationType($entityManager), 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false));
     $builder->add($builder->create('team_manager', 'hidden')->addModelTransformer($transformer));
     $builder->add('team_manager_ac', 'text', array('label' => 'Team manager', 'data' => ($user = $options['data']->getTeamManager()) ? $user->getEmployee()->getEmployeeNameFormatted() : null, 'mapped' => false, 'required' => false, 'attr' => array('placeholder' => 'Team manager', 'class' => 'width-300')));
     $builder->add($builder->create('general_manager', 'hidden')->addModelTransformer($transformer));
     $builder->add('general_manager_ac', 'text', array('label' => 'General manager', 'data' => ($user = $options['data']->getGeneralManager()) ? $user->getEmployee()->getEmployeeNameFormatted() : null, 'mapped' => false, 'attr' => array('placeholder' => 'General manager', 'class' => 'width-300')));
     $builder->add('add_travel_request', 'submit', array('label' => $this->isNew ? 'Edit travel request' : 'Add travel request', 'attr' => array('class' => 'button')));
 }
示例#7
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $regionFrom = $options['regionFrom'];
     $regionTo = $options['regionTo'];
     $floatTransformer = new FloatTransformer();
     $builder->add('securityCompany', 'entity', array('class' => 'AppTruckingBundle:SecurityCompany', 'query_builder' => function ($repository) {
         return $repository->createQueryBuilder('p')->orderBy('p.id', 'ASC');
     }, 'property' => 'name', 'empty_data' => '', 'empty_value' => 'Select', 'attr' => array('class' => 'form-control')));
     $builder->add('securityType', 'entity', array('class' => 'AppTruckingBundle:SecurityType', 'query_builder' => function ($repository) {
         return $repository->createQueryBuilder('p')->orderBy('p.id', 'ASC');
     }, 'empty_data' => '', 'empty_value' => 'Select', 'property' => 'name', 'attr' => array('class' => 'form-control')));
     $builder->add('regionFrom', 'entity', array('class' => 'CoreBundle:Region', 'query_builder' => function ($repository) {
         return $repository->createQueryBuilder('p')->orderBy('p.id', 'ASC');
     }, 'empty_data' => '', 'empty_value' => 'Select', 'required' => true, 'property' => 'nameRu', 'attr' => array('class' => 'col-md-12')));
     $builder->add('cityFrom', 'entity', array('class' => 'CoreBundle:City', 'query_builder' => function ($repository) use($regionFrom) {
         return $repository->createQueryBuilder('p')->where('p.regionId = :region')->setParameter('region', $regionFrom)->orderBy('p.id', 'ASC');
     }, 'empty_data' => '', 'empty_value' => 'Select', 'required' => true, 'property' => 'nameRu', 'attr' => array('class' => 'col-md-12')));
     $builder->add('regionTo', 'entity', array('class' => 'CoreBundle:Region', 'query_builder' => function ($repository) {
         return $repository->createQueryBuilder('p')->orderBy('p.id', 'ASC');
     }, 'empty_data' => '', 'empty_value' => 'Select', 'required' => true, 'property' => 'nameRu', 'attr' => array('class' => 'selectpicker col-md-12')));
     $builder->add('cityTo', 'entity', array('class' => 'CoreBundle:City', 'query_builder' => function ($repository) use($regionTo) {
         return $repository->createQueryBuilder('p')->where('p.regionId = :region')->setParameter('region', $regionTo)->orderBy('p.id', 'ASC');
     }, 'empty_data' => '', 'empty_value' => 'Select', 'required' => true, 'property' => 'nameRu', 'attr' => array('class' => 'col-md-12')));
     $builder->add('minWorkTime', 'text', array('label' => 'Min.working time'));
     $builder->add($builder->create('cost', 'text')->addModelTransformer($floatTransformer));
     $builder->add('addHour', 'text', array('label' => 'Additional hours'));
     $builder->add($builder->create('costAdd', 'text', array('label' => 'Additional cost'))->addModelTransformer($floatTransformer));
 }
 public function renderFormField(FormBuilderInterface &$builder, $callback = NULL, $prefix = NULL)
 {
     $fields = array();
     $skip_eq = [self::TYPE_DATETIME, self::TYPE_ARRAY];
     if (!in_array($this->getType(), $skip_eq)) {
         $fields[] = $builder->create($this->getRangedFieldName(self::RANGE_START, $prefix), 'choice', array('label' => false, 'choices' => $this->getSearchOperators()->toArray(), 'data' => $this->getSearchOperators()->getDefaultSelected(), 'attr' => array('data-prefix' => $prefix, 'data-range-type' => self::RANGE_START, 'data-range-title' => $this->getFieldName())));
     }
     switch ($this->getType()) {
         case self::TYPE_STRING:
             $fields[] = $builder->create($this->getRangedFieldName(self::RANGE_END, $prefix), 'text', array('attr' => array('data-prefix' => $prefix, 'data-range-type' => self::RANGE_END), 'required' => false));
             break;
         case self::TYPE_INTEGER:
             $fields[] = $builder->create($this->getRangedFieldName(self::RANGE_END, $prefix), 'integer', array('attr' => array('data-prefix' => $prefix, 'data-range-type' => self::RANGE_END), 'required' => false));
             break;
         case self::TYPE_DECIMAL:
             $fields[] = $builder->create($this->getRangedFieldName(self::RANGE_END, $prefix), 'number', array('attr' => array('data-prefix' => $prefix, 'data-range-type' => self::RANGE_END), 'required' => false));
             break;
             /**
              * CUSTOM FIELDS
              */
         /**
          * CUSTOM FIELDS
          */
         case self::TYPE_ARRAY:
             // dont add
             break;
         case self::TYPE_DATETIME:
             $fields[] = $builder->create($this->getRangedFieldName(self::RANGE_START, $prefix), 'datetime', array('format' => 'dd.MM.yyyy H:mm', 'widget' => 'single_text', 'attr' => array('data-prefix' => $prefix, 'data-range-type' => self::RANGE_START, 'data-range-title' => $this->getFieldName(), 'placeholder' => self::RANGE_START, 'class' => 'bs-datetimepicker', 'data-format' => 'DD.MM.YYYY H:mm'), 'required' => false));
             $fields[] = $builder->create($this->getRangedFieldName(self::RANGE_END, $prefix), 'datetime', array('format' => 'dd.MM.yyyy H:mm', 'widget' => 'single_text', 'attr' => array('data-prefix' => $prefix, 'data-range-type' => self::RANGE_END, 'placeholder' => self::RANGE_END, 'class' => 'bs-datetimepicker', 'data-format' => 'DD.MM.YYYY H:mm'), 'required' => false));
             break;
     }
     if (count($fields) > 0 && is_callable($callback)) {
         call_user_func($callback, $fields, $builder);
     }
 }
示例#9
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber($this->subscriber);
     $builder->add('autocomplete', 'oro_tag_autocomplete');
     $builder->add($builder->create('all', 'hidden')->addViewTransformer($this->transformer));
     $builder->add($builder->create('owner', 'hidden')->addViewTransformer($this->transformer));
 }
示例#10
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('page_url', 'text', ['label' => 'mautic.page.point.action.form.page.url', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.page.url.descr', 'placeholder' => 'http://']]);
     // $default = (isset($options['data']) && isset($options['data']['first_time'])) ? $options['data']['first_time'] : false;
     // $builder->add('first_time', 'yesno_button_group', array(
     //     'label'       => 'mautic.page.point.action.form.first.time.only',
     //     'attr'        => array(
     //         'tooltip' => 'mautic.page.point.action.form.first.time.only.descr'
     //     ),
     //     'data'        => $default
     // ));
     $builder->add('page_hits', 'integer', ['label' => 'mautic.page.hits', 'label_attr' => ['class' => 'control-label'], 'required' => false, 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.page.hits.descr']]);
     $formModifier = function (FormInterface $form, $data) use($builder) {
         $unit = isset($data['accumulative_time_unit']) ? $data['accumulative_time_unit'] : 'H';
         $form->add('accumulative_time_unit', 'hidden', ['data' => $unit]);
         $secondsTransformer = new SecondsConversionTransformer($unit);
         $form->add($builder->create('accumulative_time', 'text', ['label' => 'mautic.page.point.action.form.accumulative.time', 'required' => false, 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.accumulative.time.descr'], 'auto_initialize' => false])->addViewTransformer($secondsTransformer)->getForm());
         $unit = isset($data['returns_within_unit']) ? $data['returns_within_unit'] : 'H';
         $secondsTransformer = new SecondsConversionTransformer($unit);
         $form->add('returns_within_unit', 'hidden', ['data' => $unit]);
         $form->add($builder->create('returns_within', 'text', ['label' => 'mautic.page.point.action.form.returns.within', 'required' => false, 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.returns.within.descr', 'onBlur' => 'Mautic.EnablesOption(this.id)'], 'auto_initialize' => false])->addViewTransformer($secondsTransformer)->getForm());
         $unit = isset($data['returns_after_unit']) ? $data['returns_after_unit'] : 'H';
         $secondsTransformer = new SecondsConversionTransformer($unit);
         $form->add('returns_after_unit', 'hidden', ['data' => $unit]);
         $form->add($builder->create('returns_after', 'text', ['label' => 'mautic.page.point.action.form.returns.after', 'required' => false, 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.returns.after.descr', 'onBlur' => 'Mautic.EnablesOption(this.id)'], 'auto_initialize' => false])->addViewTransformer($secondsTransformer)->getForm());
     };
     $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($formModifier) {
         $data = $event->getData();
         $formModifier($event->getForm(), $data);
     });
     $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use($formModifier) {
         $data = $event->getData();
         $formModifier($event->getForm(), $data);
     });
 }
示例#11
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new AddCodeFormSubscriber())->addEventSubscriber(new BuildReportDataFetcherFormSubscriber($this->dataFetcherRegistry, $builder->getFormFactory()))->addEventSubscriber(new BuildReportRendererFormSubscriber($this->rendererRegistry, $builder->getFormFactory()))->add('name', 'text', ['label' => 'sylius.form.report.name', 'required' => true])->add('description', 'textarea', ['label' => 'sylius.form.report.description', 'required' => false])->add('dataFetcher', 'sylius_data_fetcher_choice', ['label' => 'sylius.form.report.data_fetcher'])->add('renderer', 'sylius_renderer_choice', ['label' => 'sylius.form.report.renderer.label']);
     $prototypes = ['renderers' => [], 'dataFetchers' => []];
     foreach ($this->rendererRegistry->all() as $type => $renderer) {
         $formType = sprintf('sylius_renderer_%s', $renderer->getType());
         if (!$formType) {
             continue;
         }
         try {
             $prototypes['renderers'][$type] = $builder->create('rendererConfiguration', $formType)->getForm();
         } catch (\InvalidArgumentException $e) {
             continue;
         }
     }
     foreach ($this->dataFetcherRegistry->all() as $type => $dataFetcher) {
         $formType = sprintf('sylius_data_fetcher_%s', $dataFetcher->getType());
         if (!$formType) {
             continue;
         }
         try {
             $prototypes['dataFetchers'][$type] = $builder->create('dataFetcherConfiguration', $formType)->getForm();
         } catch (\InvalidArgumentException $e) {
             continue;
         }
     }
     $builder->setAttribute('prototypes', $prototypes);
 }
示例#12
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $config = $this->config;
     $builder->add('company_name', 'text', array('label' => '会社名', 'required' => false, 'constraints' => array(new Assert\Length(array('max' => $config['stext_len'])))))->add('shop_name', 'text', array('label' => '店名', 'required' => true, 'constraints' => array(new Assert\NotBlank(), new Assert\Length(array('max' => $config['stext_len'])))))->add('shop_name_eng', 'text', array('label' => '店名(英語表記)', 'required' => false, 'constraints' => array(new Assert\Length(array('max' => $config['mtext_len'])), new Assert\Regex(array('pattern' => '/^[[:graph:][:space:]]+$/i')))))->add('zip', 'zip', array('required' => false))->add('address', 'address', array('required' => false))->add('tel', 'tel', array('required' => false))->add('fax', 'tel', array('required' => false))->add('business_hour', 'text', array('label' => '店舗営業時間', 'required' => false, 'constraints' => array(new Assert\Length(array('max' => $config['stext_len'])))))->add('email01', 'email', array('label' => '送信元メールアドレス(From)', 'required' => false, 'constraints' => array(new Assert\NotBlank(), new Assert\Email(array('strict' => true)))))->add('email02', 'email', array('label' => '問い合わせ受付メールアドレス(From, ReplyTo)', 'required' => false, 'constraints' => array(new Assert\NotBlank(), new Assert\Email(array('strict' => true)))))->add('email03', 'email', array('label' => '返信受付メールアドレス(ReplyTo)', 'required' => false, 'constraints' => array(new Assert\NotBlank(), new Assert\Email(array('strict' => true)))))->add('email04', 'email', array('label' => '送信エラー受付メールアドレス(ReturnPath)', 'required' => false, 'constraints' => array(new Assert\NotBlank(), new Assert\Email(array('strict' => true)))))->add('good_traded', 'textarea', array('label' => '取り扱い商品', 'required' => false, 'constraints' => array(new Assert\Length(array('max' => $config['lltext_len'])))))->add('message', 'textarea', array('label' => 'メッセージ', 'required' => false, 'constraints' => array(new Assert\Length(array('max' => $config['lltext_len'])))))->add('delivery_free_amount', 'money', array('label' => '送料無料条件(金額)', 'required' => false, 'currency' => 'JPY', 'precision' => 0, 'constraints' => array(new Assert\Length(array('max' => $config['price_len'])), new Assert\Regex(array('pattern' => "/^\\d+\$/u", 'message' => 'form.type.numeric.invalid')))))->add('delivery_free_quantity', 'integer', array('label' => '送料無料条件(数量)', 'required' => false, 'constraints' => array(new Assert\Regex(array('pattern' => "/^\\d+\$/u", 'message' => 'form.type.numeric.invalid')))))->add('option_product_delivery_fee', 'choice', array('label' => '商品ごとの送料設定を有効にする', 'choices' => array('0' => '無効', '1' => '有効'), 'expanded' => true, 'multiple' => false))->add('option_multiple_shipping', 'choice', array('label' => '複数配送を有効にする', 'choices' => array('0' => '無効', '1' => '有効'), 'expanded' => true, 'multiple' => false))->add('option_customer_activate', 'choice', array('label' => '仮会員を有効にする', 'choices' => array('0' => '無効', '1' => '有効'), 'expanded' => true, 'multiple' => false))->add('option_mypage_order_status_display', 'choice', array('label' => 'マイページに注文状況を表示する', 'choices' => array('0' => '無効', '1' => '有効'), 'expanded' => true, 'multiple' => false))->add('option_remember_me', 'choice', array('label' => '自動ログイン機能を有効にする', 'choices' => array('0' => '無効', '1' => '有効'), 'expanded' => true, 'multiple' => false))->add('option_favorite_product', 'choice', array('label' => 'お気に入り商品機能を利用する', 'choices' => array('0' => '無効', '1' => '有効'), 'expanded' => true, 'multiple' => false))->add('nostock_hidden', 'choice', array('label' => '在庫切れ商品を非表示にする', 'choices' => array('0' => '無効', '1' => '有効'), 'expanded' => true, 'multiple' => false))->add('latitude', 'number', array('label' => '緯度', 'required' => false, 'precision' => 6, 'constraints' => array(new Assert\Regex(array('pattern' => '/^-?([0-8]?[0-9]\\.?[0-9]{0,6}|90\\.?0{0,6})$/', 'message' => 'admin.shop.latitude.invalid')))))->add('longitude', 'number', array('label' => '経度', 'required' => false, 'precision' => 6, 'constraints' => array(new Assert\Regex(array('pattern' => '/^-?((1?[0-7]?|[0-9]?)[0-9]\\.?[0-9]{0,6}|180\\.?0{0,6})$/', 'message' => 'admin.shop.longitude.invalid')))));
     $builder->add($builder->create('company_kana', 'text', array('label' => '会社名(フリガナ)', 'required' => false, 'constraints' => array(new Assert\Regex(array('pattern' => "/^[ァ-ヶヲ-゚ー]+\$/u")), new Assert\Length(array('max' => $config['stext_len'])))))->addEventSubscriber(new \Eccube\EventListener\ConvertKanaListener('CV')));
     $builder->add($builder->create('shop_kana', 'text', array('label' => '店名(フリガナ)', 'required' => false, 'constraints' => array(new Assert\Length(array('max' => $config['stext_len'])), new Assert\Regex(array('pattern' => "/^[ァ-ヶヲ-゚ー]+\$/u")))))->addEventSubscriber(new \Eccube\EventListener\ConvertKanaListener('CV')));
 }
示例#13
0
 /**
  * Create a new tab and nest it under the tabs.
  *
  * @param string $name
  * @param string $label
  * @param array  $options
  *
  * @return FormBuilderInterface The created tab.
  */
 public function createTab($name, $label, $options = array())
 {
     $options = array_replace($options, array('label' => $label, 'inherit_data' => true));
     $tab = $this->formBuilder->create($name, TabsTabType::class, $options);
     $this->formBuilder->get('tabs')->add($tab);
     return $tab;
 }
示例#14
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('name', 'textarea', array('label' => 'ddi.lead_actions.tasks.thead.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'nomousetrap form-control', 'rows' => 10), 'constraints' => array(new NotBlank(array('message' => 'ddi.lead_actions.task.name.notblank')))));
     // Campaign builder form
     if (!empty($options['type'])) {
         $data = empty($options['data']['dateInterval']) ? 1 : $options['data']['dateInterval'];
         $builder->add('dateInterval', 'number', array('label' => 'ddi.lead_actions.tasks.form.due_date_after', 'attr' => array('class' => 'form-control', 'preaddon' => 'symbol-hashtag'), 'data' => $data));
         $data = !empty($options['data']['dateIntervalUnit']) ? $options['data']['dateIntervalUnit'] : 'd';
         $builder->add('dateIntervalUnit', 'choice', array('choices' => array('i' => 'mautic.campaign.event.intervalunit.choice.i', 'h' => 'mautic.campaign.event.intervalunit.choice.h', 'd' => 'mautic.campaign.event.intervalunit.choice.d', 'm' => 'mautic.campaign.event.intervalunit.choice.m', 'y' => 'mautic.campaign.event.intervalunit.choice.y'), 'multiple' => false, 'label_attr' => array('class' => 'control-label'), 'label' => false, 'attr' => array('class' => 'form-control'), 'empty_value' => false, 'required' => false, 'data' => $data));
         // Default form
     } else {
         $dueDate = $builder->create('dueDate', 'datetime', array('widget' => 'single_text', 'label' => 'ddi.lead_actions.tasks.thead.due_date', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'nomousetrap form-control', 'data-toggle' => 'datetime', 'preaddon' => 'fa fa-calendar'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => true, 'constraints' => array(new NotBlank(array('message' => 'ddi.lead_actions.task.due_date.notblank')))));
         $builder->add($dueDate);
         $builder->add('buttons', 'form_buttons', array('apply_text' => false, 'save_text' => 'mautic.core.form.save'));
     }
     $assignUser = $builder->create('assignUser', 'user_list', array('label' => 'ddi.lead_actions.tasks.thead.assigned_user', 'label_attr' => array('class' => 'control-label, required'), 'attr' => array('class' => 'nomousetrap form-control'), 'required' => false, 'multiple' => false, 'constraints' => array(new NotBlank(array('message' => 'ddi.lead_actions.task.assigned_user.notblank')))));
     if (empty($options['type'])) {
         $transformer = new IdToEntityModelTransformer($this->factory->getEntityManager(), 'MauticUserBundle:User');
         $assignUser->addModelTransformer($transformer);
     }
     $builder->add($assignUser);
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
示例#15
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['content' => 'html']));
     $builder->addEventSubscriber(new FormExitSubscriber('dynamicContent.dynamicContent', $options));
     $builder->add('name', 'text', ['label' => 'mautic.dynamicContent.form.internal.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $emojiTransformer = new EmojiToShortTransformer();
     $builder->add($builder->create('description', 'textarea', ['label' => 'mautic.dynamicContent.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false])->addModelTransformer($emojiTransformer));
     $builder->add('isPublished', 'yesno_button_group');
     $builder->add('language', 'locale', ['label' => 'mautic.core.language', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
     $builder->add('publishUp', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     $builder->add('publishDown', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     $builder->add('content', 'textarea', ['label' => 'mautic.dynamicContent.form.content', 'label_attr' => ['class' => 'control-label'], 'attr' => ['tooltip' => 'mautic.dynamicContent.form.content.help', 'class' => 'form-control editor editor-advanced editor-builder-tokens', 'rows' => '15'], 'required' => false]);
     $transformer = new IdToEntityModelTransformer($this->em, 'MauticDynamicContentBundle:DynamicContent');
     $builder->add($builder->create('translationParent', 'dwc_list', ['label' => 'mautic.core.form.translation_parent', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.core.form.translation_parent.help'], 'required' => false, 'multiple' => false, 'empty_value' => 'mautic.core.form.translation_parent.empty', 'top_level' => 'translation', 'ignore_ids' => [(int) $options['data']->getId()]])->addModelTransformer($transformer));
     $builder->add('category', 'category', ['bundle' => 'dynamicContent']);
     if (!empty($options['update_select'])) {
         $builder->add('buttons', 'form_buttons', ['apply_text' => false]);
         $builder->add('updateSelect', 'hidden', ['data' => $options['update_select'], 'mapped' => false]);
     } else {
         $builder->add('buttons', 'form_buttons');
     }
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
示例#16
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $em = $options['em'];
     $searchTagsTransformer = new SearchTagsToStringTransformer($em);
     $thematicGroupTransformer = new ThematicGroupToNumberTransformer($em);
     $groups = $em->getRepository('EvrikaMainBundle:ThematicGroup')->findGroupsForUser($options['user']);
     $moderatedGroupsChoices = array();
     foreach ($groups as $group) {
         $moderatedGroupsChoices[$group->getId()] = $group;
     }
     if ($options['user']->getUserType() == 'doctor') {
         $filter = 'c.inUserFeed';
     } else {
         // компания
         $filter = 'c.inGroupFeed';
     }
     $categories = $em->createQuery('SELECT c FROM EvrikaMainBundle:Category c WHERE ' . $filter . ' = 1 AND c.id != 50 ORDER BY c.title')->getResult();
     $categoryChoices = array();
     foreach ($categories as $category) {
         $categoryChoices[$category->getId()] = $category;
     }
     $builder->add('category', null, array('label' => 'Категория', 'choices' => $categoryChoices))->add('title', null, array('label' => 'Заголовок', 'attr' => array('placeholder' => 'Заголовок')))->add('shortText', null, array('label' => 'Вступление/анонс', 'required' => false, 'attr' => array('placeholder' => 'Вступление', 'class' => 'ckeditor_less')))->add('body', null, array('label' => 'Остальной текст публикации', 'required' => false, 'attr' => array('placeholder' => 'Остальной текст публикации', 'class' => 'ckeditor')))->add('imageFile', 'iphp_file', array('label' => 'Картинка для отображения в ленте', 'required' => false))->add('embeddedCode', null, array('label' => 'HTML-код видео'))->add('sourceTitle', null, array('label' => 'Название источника'))->add('sourceUrl', null, array('label' => 'Ссылка источник'));
     if (count($moderatedGroupsChoices) > 0) {
         if ($options['user']->getUserType() == 'doctor') {
             $builder->add($builder->create('thematicGroup', 'choice', array('label' => 'Опубликовать в тематической группе', 'choices' => $moderatedGroupsChoices, 'required' => false, 'empty_value' => 'Нет'))->addModelTransformer($thematicGroupTransformer));
         } else {
             $builder->add($builder->create('thematicGroup', 'choice', array('label' => 'Выберите компанию', 'choices' => $moderatedGroupsChoices, 'required' => true))->addModelTransformer($thematicGroupTransformer));
         }
     }
     $builder->add('specialties', null, array('label' => 'Для специальностей', 'required' => false))->add($builder->create('searchTags', 'text', array('label' => 'Ключевые слова', 'required' => false, 'by_reference' => false))->addModelTransformer($searchTagsTransformer));
 }
 public function buildForm(Form\FormBuilderInterface $builder, array $options)
 {
     $builder->add('thresholds', 'currency_set', ['label' => 'ms.discount.discount.criteria.thresholds.label', 'options' => ['label' => false]]);
     $builder->add($builder->create('products', 'choice', ['label' => 'ms.discount.discount.criteria.products.label', 'choices' => $this->_products, 'multiple' => true, 'expanded' => true])->addModelTransformer(new DiscountProductTransformer($this->_productLoader)));
     $builder->add($builder->create('emails', 'textarea', ['label' => 'ms.discount.discount.criteria.emails.label', 'contextual_help' => 'ms.discount.discount.criteria.emails.help'])->addModelTransformer(new DiscountEmailTransformer()));
     $builder->addEventListener(Form\FormEvents::PRE_SET_DATA, [$this, 'onPreSetData']);
     $builder->addEventListener(Form\FormEvents::POST_SUBMIT, array($this, 'onPostSubmit'));
 }
示例#18
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('title', 'text')->add('urltitle', 'text', array('required' => false, 'label' => __('PermaLink URL title')))->add($builder->create('metadescription', 'textarea', array('required' => false))->addModelTransformer(new NullToEmptyTransformer()))->add($builder->create('metakeywords', 'textarea', array('required' => false))->addModelTransformer(new NullToEmptyTransformer()))->add('content')->add('displaywrapper', 'checkbox', array('required' => false, 'label' => __('Display additional information')))->add('displaytitle', 'checkbox', array('required' => false, 'label' => __('Display page title')))->add('displaycreated', 'checkbox', array('required' => false, 'label' => __('Display page creation date')))->add('displayupdated', 'checkbox', array('required' => false, 'label' => __('Display page update date')))->add('displaytextinfo', 'checkbox', array('required' => false, 'label' => __('Display page text statistics')))->add('displayprint', 'checkbox', array('required' => false, 'label' => __('Display page print link')))->add($builder->create('language', 'choice', array('choices' => \ZLanguage::getInstalledLanguageNames(), 'required' => false, 'placeholder' => __('All')))->addModelTransformer(new NullToEmptyTransformer()))->add('obj_status', 'checkbox', array('required' => false, 'label' => __('Page is active')))->add('save', 'submit', array('label' => 'Create Page'));
     $entityCategoryRegistries = \CategoryRegistryUtil::getRegisteredModuleCategories('ZikulaPagesModule', 'PageEntity', 'id');
     foreach ($entityCategoryRegistries as $registryId => $parentCategoryId) {
         $builder->add('categories', new CategoryType($registryId, $parentCategoryId), array('multiple' => true));
     }
 }
示例#19
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $mailerTransports = array('null' => 'Disabled', 'smtp' => 'SMTP', 'gmail' => 'Gmail', 'mail' => 'PHP mail() function');
     $authModes = array('plain' => 'Plain', 'login' => 'Login', 'cram-md5' => 'Cram MD5');
     $encryptions = array('ssl' => 'SSL', 'tls' => 'TLS');
     $project = $builder->create('project', 'form', array('virtual' => true))->add('locale', 'gitonomy_locale', array('label' => 'form.project.locale'))->add('ssh_access', 'text', array('label' => 'form.project.ssh_access'))->add('name', 'text', array('label' => 'form.project.name'))->add('baseline', 'text', array('label' => 'form.project.baseline'))->add('open_registration', 'checkbox', array('required' => false, 'label' => 'form.project.open_registration'));
     $mailer = $builder->create('mailer', 'form', array('virtual' => true))->add('mailer_transport', 'choice', array('required' => true, 'choices' => $mailerTransports, 'label' => 'form.mailer.transport'))->add('mailer_host', 'text', array('required' => false, 'label' => 'form.mailer.host'))->add('mailer_port', 'number', array('required' => false, 'label' => 'form.mailer.port'))->add('mailer_username', 'text', array('required' => false, 'label' => 'form.mailer.username'))->add('mailer_password', 'password', array('required' => false, 'always_empty' => 'false', 'label' => 'form.mailer.password'))->add('mailer_auth_mode', 'choice', array('required' => false, 'choices' => $authModes, 'label' => 'form.mailer.auth_mode'))->add('mailer_encryption', 'choice', array('required' => false, 'choices' => $encryptions, 'label' => 'form.mailer.encryption'))->add('mailer_from_name', 'text', array('required' => false, 'label' => 'form.mailer.from_name'))->add('mailer_from_email', 'email', array('required' => false, 'label' => 'form.mailer.from_email'));
     $builder->add($project)->add($mailer);
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $statusTransformer = new StatusTransformer();
     $statusOptions = $statusTransformer->getOptions();
     $builder->add($builder->create('ticketStatus', 'choice', array('label' => 'diamante.desk.comment.ticket_status', 'required' => true, 'choices' => $statusOptions))->addModelTransformer($statusTransformer));
     $builder->add('content', 'oro_rich_text', array('label' => 'diamante.desk.comment.content', 'required' => true));
     $builder->add($builder->create('attachmentsInput', 'file', array('label' => 'diamante.desk.attachment.entity_plural_label', 'required' => false, 'attr' => array('multiple' => 'multiple')))->addModelTransformer(new AttachmentTransformer()));
     $builder->add('private', 'checkbox', array('label' => 'diamante.desk.comment.private', 'required' => false));
 }
示例#21
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('site_url', 'text', array('label' => 'mautic.core.config.form.site.url', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.site.url.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('webroot', 'page_list', array('label' => 'mautic.core.config.form.webroot', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.webroot.tooltip', 'data-placeholder' => $this->factory->getTranslator()->trans('mautic.core.config.form.webroot.dashboard')), 'multiple' => false, 'empty_value' => '', 'required' => false));
     $builder->add('cache_path', 'text', array('label' => 'mautic.core.config.form.cache.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cache.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('log_path', 'text', array('label' => 'mautic.core.config.form.log.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.log.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('image_path', 'text', array('label' => 'mautic.core.config.form.image.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.image.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('theme', 'theme_list', array('label' => 'mautic.core.config.form.theme', 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.template.help')));
     // Get the list of available languages
     /** @var \Mautic\CoreBundle\Helper\LanguageHelper $languageHelper */
     $languageHelper = $this->factory->getHelper('language');
     $languages = $languageHelper->fetchLanguages(false, false);
     $langChoices = array();
     foreach ($languages as $code => $langData) {
         $langChoices[$code] = $langData['name'];
     }
     $langChoices = array_merge($langChoices, $this->factory->getParameter('supported_languages'));
     // Alpha sort the languages by name
     asort($langChoices);
     $builder->add('locale', 'choice', array('choices' => $langChoices, 'label' => 'mautic.core.config.form.locale', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.locale.tooltip'), 'empty_value' => false));
     $arrayStringTransformer = new ArrayStringTransformer();
     $builder->add($builder->create('trusted_hosts', 'text', array('label' => 'mautic.core.config.form.trusted.hosts', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.hosts.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
     $builder->add($builder->create('trusted_proxies', 'text', array('label' => 'mautic.core.config.form.trusted.proxies', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.proxies.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
     $arrayLinebreakTransformer = new ArrayLinebreakTransformer();
     $builder->add($builder->create('do_not_track_ips', 'textarea', array('label' => 'mautic.core.config.form.do_not_track_ips', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.do_not_track_ips.tooltip'), 'required' => false))->addViewTransformer($arrayLinebreakTransformer));
     $builder->add('rememberme_key', 'text', array('label' => 'mautic.core.config.form.rememberme.key', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.key.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('rememberme_lifetime', 'text', array('label' => 'mautic.core.config.form.rememberme.lifetime', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.lifetime.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('rememberme_path', 'text', array('label' => 'mautic.core.config.form.rememberme.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('rememberme_domain', 'text', array('label' => 'mautic.core.config.form.rememberme.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.domain.tooltip'), 'required' => false));
     $builder->add('default_pagelimit', 'choice', array('choices' => array(5 => 'mautic.core.pagination.5', 10 => 'mautic.core.pagination.10', 15 => 'mautic.core.pagination.15', 20 => 'mautic.core.pagination.20', 25 => 'mautic.core.pagination.25', 30 => 'mautic.core.pagination.30', 50 => 'mautic.core.pagination.50', 100 => 'mautic.core.pagination.100'), 'expanded' => false, 'multiple' => false, 'label' => 'mautic.core.config.form.default.pagelimit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.pagelimit.tooltip'), 'required' => false, 'empty_value' => false));
     $builder->add('default_timezone', 'timezone', array('label' => 'mautic.core.config.form.default.timezone', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.timezone.tooltip'), 'multiple' => false, 'empty_value' => 'mautic.user.user.form.defaulttimezone', 'required' => false));
     $builder->add('date_format_full', 'text', array('label' => 'mautic.core.config.form.date.format.full', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.full.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('date_format_short', 'text', array('label' => 'mautic.core.config.form.date.format.short', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.short.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('date_format_dateonly', 'text', array('label' => 'mautic.core.config.form.date.format.dateonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.dateonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('date_format_timeonly', 'text', array('label' => 'mautic.core.config.form.date.format.timeonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.timeonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     // Search for IP Services
     $bundles = $this->factory->getMauticBundles(true);
     $choices = array();
     foreach ($bundles as $bundle) {
         if (isset($bundle['config']['ip_lookup_services'])) {
             foreach ($bundle['config']['ip_lookup_services'] as $service => $details) {
                 $choices[$service] = $details['display_name'];
             }
         }
     }
     natcasesort($choices);
     $builder->add('ip_lookup_service', 'choice', array('choices' => $choices, 'label' => 'mautic.core.config.form.ip.lookup.service', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.service.tooltip')));
     $builder->add('ip_lookup_auth', 'text', array('label' => 'mautic.core.config.form.ip.lookup.auth', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.auth.tooltip'), 'required' => false));
     $builder->add('transifex_username', 'text', array('label' => 'mautic.core.config.form.transifex.username', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.transifex.username.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('transifex_password', 'password', array('label' => 'mautic.core.config.form.transifex.password', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => 'mautic.user.user.form.passwordplaceholder', 'preaddon' => 'fa fa-lock', 'tooltip' => 'mautic.core.config.form.transifex.password.tooltip', 'autocomplete' => 'off'), 'required' => false));
     $builder->add('update_stability', 'choice', array('choices' => array('alpha' => 'mautic.core.config.update_stability.alpha', 'beta' => 'mautic.core.config.update_stability.beta', 'rc' => 'mautic.core.config.update_stability.rc', 'stable' => 'mautic.core.config.update_stability.stable'), 'label' => 'mautic.core.config.form.update.stability', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.update.stability.tooltip'), 'empty_value' => false));
     $builder->add('cookie_path', 'text', array('label' => 'mautic.core.config.form.cookie.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
     $builder->add('cookie_domain', 'text', array('label' => 'mautic.core.config.form.cookie.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.domain.tooltip'), 'required' => false));
     $builder->add('cookie_secure', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.secure', 'empty_value' => 'mautic.core.form.default', 'data' => array_key_exists('cookie_secure', $options['data']) && !empty($options['data']['cookie_secure']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.secure.tooltip')));
     $builder->add('cookie_httponly', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.httponly', 'data' => array_key_exists('cookie_httponly', $options['data']) && !empty($options['data']['cookie_httponly']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.httponly.tooltip')));
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $weight_transformer = new StringToWeightTransformer();
     $liter_transformer = new StringToLiterTransformer();
     $builder->add('name', TextType::class, array('label' => 'asf.product.product_name', 'required' => true))->add($builder->create('weight', TextType::class, array('label' => 'asf.product.weight', 'required' => false))->addModelTransformer($weight_transformer))->add($builder->create('capacity', TextType::class, array('label' => 'asf.product.capacity', 'required' => false))->addModelTransformer($liter_transformer));
     if (true === $this->isBrandEntityEnabled) {
         $builder->add('brand', SearchBrandType::class);
     }
     $builder->add('categories', BaseCollectionType::class, array('entry_type' => SearchCategoryType::class, 'label' => 'asf.product.form.categories_list', 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'containerId' => 'categories-collection'))->add('state', ChoiceType::class, array('label' => 'asf.product.state', 'required' => true, 'choices' => array('asf.product.state.draft' => ProductModel::STATE_DRAFT, 'asf.product.state.waiting' => ProductModel::STATE_WAITING, 'asf.product.state.published' => ProductModel::STATE_PUBLISHED)));
 }
示例#23
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $cityToStringTransformer = new CityToStringTransformer($this->em);
     $yearToNumberTransformer = new YearToNumberTransformer($this->em);
     $years = array();
     for ($i = date('Y'); $i > date('Y') - 70; $i--) {
         $years[$i] = $i;
     }
     $builder->add('lastName', null, array('label' => 'Фамилия', 'required' => true))->add('firstName', null, array('label' => 'Имя', 'required' => true))->add('surName', null, array('label' => 'Отчество', 'required' => true))->add('gender', 'choice', array('label' => 'Пол', 'required' => true, 'choices' => array('m' => 'Мужской', 'f' => 'Женский')))->add('birthdate', 'date', array('label' => 'Дата рождения', 'required' => true, 'widget' => 'single_text', 'format' => 'dd.MM.yyyy', 'invalid_message' => 'Дата указана неверно. Формат: 31.01.1970', 'attr' => array('class' => 'input-calendar', 'title' => '31.01.1970 как пример')))->add('post', 'choice', array('label' => 'Должность', 'required' => true, 'choices' => array('медицинский представитель' => 'медицинский представитель', 'региональный менеджер' => 'региональный менеджер', 'супервайзер' => 'супервайзер', 'мерчендайзер' => 'мерчендайзер')))->add($builder->create('city', 'text', array('label' => 'Город', 'required' => true))->addModelTransformer($cityToStringTransformer))->add('fixedArea', 'choice', array('label' => 'Закрепленная территория', 'required' => false, 'choices' => array('Центральный административный округ' => 'Центральный административный округ', 'Северный административный округ' => 'Северный административный округ', 'Северо-Восточный административный округ' => 'Северо-Восточный административный округ', 'Восточный административный округ' => 'Восточный административный округ', 'Юго-Восточный административный округ' => 'Юго-Восточный административный округ', 'Южный административный округ' => 'Южный административный округ', 'Юго-Западный административный округ' => 'Юго-Западный административный округ', 'Западный административный округ' => 'Западный административный округ', 'Северо-Западный административный округ' => 'Северо-Западный административный округ', 'Зеленоградский административный округ' => 'Зеленоградский административный округ', 'Новомосковский административный округ' => 'Новомосковский административный округ', 'Троицкий административный округ' => 'Троицкий административный округ'), 'empty_data' => null, 'attr' => array('class' => 'moscow-area', 'data-placeholder' => 'Только для г. Москва')))->add('specialties', null, array('label' => 'Специальности', 'required' => true, 'empty_value' => 'выберите', 'attr' => array('data-placeholder' => 'выберите одну или несколько')))->add('university', null, array('label' => 'ВУЗ', 'empty_value' => 'выберите', 'required' => true, 'attr' => array('data-placeholder' => 'выберите')))->add($builder->create('graduateYear', 'choice', array('label' => 'Год окончания', 'required' => true, 'choices' => $years, 'empty_value' => 'выберите', 'attr' => array('data-placeholder' => 'выберите')))->addModelTransformer($yearToNumberTransformer))->add('phone', null, array('label' => 'Контактный телефон', 'required' => true))->add('username', null, array('label' => 'E-mail', 'required' => true))->add('password', 'repeated', array('type' => 'password', 'invalid_message' => 'Пароли должны совпадать', 'options' => array('attr' => array('class' => 'password-field')), 'required' => true, 'first_options' => array('label' => 'Пароль'), 'second_options' => array('label' => 'Повторите пароль'), 'constraints' => new Length(array('min' => 6, 'max' => 50, 'minMessage' => "Пароль не может быть короче {{ limit }} символов", 'maxMessage' => "Пароль не может быть длиннее {{ limit }} символов"))))->add('eula', 'checkbox', array('label' => 'Я согласен(на) c <a target="_blank" href="/eula">пользовательским соглашением</a>', 'required' => true, 'mapped' => false, 'constraints' => new True(array('message' => 'Пожалуйста, подтвердите что вы согласны с пользовательским соглашением'))))->add('submit', 'submit', array('label' => 'ЗАРЕГЕСТРИРОВАТЬСЯ', 'attr' => array('class' => 'btn-red')))->add('hash', 'hidden', array());
 }
示例#24
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $cityToStringTransformer = new CityToStringTransformer($this->em);
     $yearToNumberTransformer = new YearToNumberTransformer($this->em);
     $years = array();
     for ($i = date('Y'); $i > date('Y') - 70; $i--) {
         $years[$i] = $i;
     }
     $builder->add('avatar', 'iphp_file', array('label' => 'Фотография', 'required' => false))->add('lastName', null, array('label' => 'Фамилия'))->add('firstName', null, array('label' => 'Имя'))->add('surName', null, array('label' => 'Отчество'))->add('birthdate', 'date', array('label' => 'Дата рождения', 'widget' => 'single_text', 'format' => 'dd.MM.yyyy', 'invalid_message' => 'Дата указана неверно. Формат: 31.01.1970', 'attr' => array('class' => 'input-calendar', 'title' => '31.01.1970 как пример')))->add($builder->create('city', 'text', array('label' => 'Город'))->addModelTransformer($cityToStringTransformer))->add('specializations', null, array('label' => 'Специализации', 'empty_value' => 'выберите', 'required' => true, 'attr' => array('data-placeholder' => 'выберите одну или несколько')))->add('university', null, array('label' => 'ВУЗ', 'required' => true, 'attr' => array('data-placeholder' => 'выберите')))->add($builder->create('graduateYear', 'choice', array('label' => 'Год окончания', 'choices' => $years, 'empty_value' => 'выберите', 'attr' => array('data-placeholder' => 'выберите')))->addModelTransformer($yearToNumberTransformer))->add('job', null, array('label' => 'Место работы', 'required' => true, 'attr' => array('class' => 'input-document')))->add('phone', null, array('label' => 'Контактный телефон', 'required' => true))->add('rohId', null, array('label' => 'Номер члена РОХ', 'required' => false, 'attr' => array('placeholder' => 'если есть')))->add('scanSpecialist', 'iphp_file', array('label' => 'Сертификат врача*  <span style="font-size: 10px;"> страница с указанием ФИО</span>', 'required' => false))->add('scanSpecialist2', 'iphp_file', array('label' => 'Сертификат врача*  <span style="font-size: 10px;">страница с датой действия сертификата</span>', 'required' => false))->add('submit', 'submit', array('label' => 'СОХРАНИТЬ', 'attr' => array('class' => 'btn-red')));
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $transformer = new TagsToArrayTransformer();
     $metadataTransformer = new MetadataTransformer();
     $builder->add("title", "text", array("required" => true, "attr" => array("class" => $this->defaultClass, "placeholder" => "The title")));
     $builder->add("content", "textarea", array("attr" => array("placeholder" => "the content", "rows" => 20, "class" => $this->defaultClass)));
     $builder->add($builder->create('metadatas', 'collection', array("type" => new MetaData(), 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false))->addModelTransformer($metadataTransformer));
     $builder->add($builder->create("tags", "text", array("attr" => array("class" => $this->defaultClass, "placeholder" => "ms, apple ,samsung, nokia")))->prependNormTransformer($transformer));
     $builder->add("featured", "checkbox", array('required' => false));
 }
示例#26
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $cityToStringTransformer = new CityToStringTransformer($this->em);
     $yearToNumberTransformer = new YearToNumberTransformer($this->em);
     $years = array();
     for ($i = date('Y'); $i > date('Y') - 70; $i--) {
         $years[$i] = $i;
     }
     $builder->add('avatar', 'iphp_file', array('label' => 'Фотография', 'required' => false))->add('lastName', null, array('label' => 'Фамилия', 'required' => true))->add('firstName', null, array('label' => 'Имя', 'required' => true))->add('surName', null, array('label' => 'Отчество', 'required' => true))->add('birthdate', 'date', array('label' => 'Дата рождения', 'required' => true, 'widget' => 'single_text', 'format' => 'dd.MM.yyyy', 'invalid_message' => 'Дата указана неверно. Формат: 31.01.1970', 'attr' => array('class' => 'input-calendar', 'title' => '31.01.1970 как пример')))->add($builder->create('city', 'text', array('label' => 'Город', 'required' => true))->addModelTransformer($cityToStringTransformer))->add('specializations', null, array('label' => 'Специализацию', 'required' => true, 'empty_value' => 'выберите', 'attr' => array('data-placeholder' => 'выберите одну или несколько')))->add('university', null, array('label' => 'ВУЗ', 'empty_value' => 'выберите', 'required' => true, 'attr' => array('data-placeholder' => 'выберите')))->add($builder->create('graduateYear', 'choice', array('label' => 'Год окончания', 'required' => true, 'choices' => $years, 'empty_value' => 'выберите', 'attr' => array('data-placeholder' => 'выберите')))->addModelTransformer($yearToNumberTransformer))->add('job', null, array('label' => 'Место работы', 'required' => true, 'attr' => array('class' => 'input-document')))->add('phone', null, array('label' => 'Контактный телефон', 'required' => true))->add('rohId', null, array('label' => 'Номер члена РОХ', 'required' => false, 'attr' => array('placeholder' => 'обязательно для члена РОХ')))->add('scanSpecialist', 'iphp_file', array('label' => 'Сертификат * <span style="font-size: 10px;">страница с указанием ФИО</span>', 'required' => false))->add('scanSpecialist2', 'iphp_file', array('label' => 'Сертификат * <span style="font-size: 10px;">страница с датой действия сертификата</span>', 'required' => false))->add('username', null, array('label' => 'E-mail'))->add('password', 'repeated', array('type' => 'password', 'invalid_message' => 'Пароли должны совпадать', 'options' => array('attr' => array('class' => 'password-field')), 'required' => true, 'first_options' => array('label' => 'Пароль'), 'second_options' => array('label' => 'Повторите пароль')))->add('eula', 'checkbox', array('label' => 'Я согласен(на) c <a href="/eula" target="_blank">пользовательским соглашением</a><br /><br />' . 'Пожалуйста ознакомьтесь  c <a href="/oferta" target="_blank">договор-офертой об оказании услуг</a>', 'required' => true, 'mapped' => false, 'constraints' => new True(array('message' => 'Пожалуйста, подтвердите что вы согласны с пользовательским соглашением'))))->add('submit', 'submit', array('label' => 'ОТПРАВИТЬ', 'attr' => array('class' => 'btn-red')))->add('hashEvrika', 'hidden', array());
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('isVisible', 'hidden', array('required' => false, 'attr' => array('class' => 'is-visible')))->add('title', 'choice', array('choice_list' => $this->titlesLookup, 'empty_value' => '- Please Select -', 'constraints' => array(new Constraints\NotBlank(array('message' => 'Please select a title')))))->add('firstName', 'text', array('constraints' => array(new Constraints\NotBlank(array('message' => 'Please enter first name')), new Constraints\Regex(array('pattern' => '/^[-a-zA-Z0-9\\w]+$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('middleName', 'text', array('required' => false, 'constraints' => array(new Constraints\Regex(array('pattern' => '/^[ -a-zA-Z0-9\\w]*$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('lastName', 'text', array('constraints' => array(new Constraints\NotBlank(array('groups' => array('fullValidation'), 'message' => 'Please enter a last name')), new Constraints\Regex(array('pattern' => '/^[ -a-zA-Z0-9\\w]+$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('otherName', 'text', array('required' => false, 'constraints' => array(new Constraints\Regex(array('pattern' => '/^[a-zA-Z0-9\\w]*$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('birthDate', 'birthday', array('placeholder' => '--', 'constraints' => array(new Constraints\NotBlank(), new DateRange(array('min' => '-121 YEARS', 'max' => '-18 YEARS', 'maxMessage' => 'Applicant must be older than 18 years of age'))), 'attr' => array('data-provide' => 'datepicker', 'data-end-date' => date('d/m/Y'))))->add($builder->create('email', 'email', array('label' => 'Email Address', 'constraints' => array(new Constraints\NotBlank(), new Constraints\Email(array('message' => 'Please provide a valid email address')), $this->notProspectiveLandlordEmailConstraintSubscriber->getConstraint())))->addEventSubscriber($this->notApplicantEmailBridgeSubscriber))->add($builder->create('rentShare', 'money', array('label' => 'Share of Rent', 'currency' => 'GBP', 'constraints' => array($this->rentShareConstraintSubscriber->getRentShareConstraint())))->addEventSubscriber($this->rentShareConstraintSubscriber))->add('completionMethod', 'choice', array('choice_list' => $this->completionMethodLookup, 'empty_value' => '- Please Select -', 'attr' => array('class' => 'form-refresh'), 'constraints' => array(new Constraints\NotBlank())))->addEventSubscriber($options['guarantor_decorator'])->addEventSubscriber($this->notProspectiveLandlordEmailConstraintSubscriber)->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
         // Disable form validation on ajax requests by stopping all listeners listening to POST_SUBMIT with a lower weight priority than this, including the validationListener
         // Note: any listeners listening to POST_SUBMIT for AJAX requests, after this listener, are disabled as a result of this call
         if ($this->requestStack->getCurrentRequest()->isXmlHttpRequest()) {
             $event->stopPropagation();
         }
     }, 1);
 }
示例#28
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $cityToStringTransformer = new CityToStringTransformer($this->em);
     $yearToNumberTransformer = new YearToNumberTransformer($this->em);
     $years = array();
     for ($i = date('Y'); $i > date('Y') - 70; $i--) {
         $years[$i] = $i;
     }
     $builder->add('lastName', null, array('label' => 'Фамилия', 'required' => true))->add('firstName', null, array('label' => 'Имя', 'required' => true))->add('surName', null, array('label' => 'Отчество', 'required' => true))->add('birthdate', 'date', array('label' => 'Дата рождения', 'required' => true, 'widget' => 'single_text', 'format' => 'dd.MM.yyyy', 'invalid_message' => 'Дата указана неверно. Формат: 31.01.1970', 'attr' => array('class' => 'input-calendar', 'title' => '31.01.1970 как пример')))->add($builder->create('city', 'text', array('label' => 'Город', 'required' => true))->addModelTransformer($cityToStringTransformer))->add('specialties', null, array('label' => 'Специальности', 'required' => true, 'empty_value' => 'выберите', 'attr' => array('data-placeholder' => 'выберите одну или несколько')))->add('university', null, array('label' => 'ВУЗ', 'empty_value' => 'выберите', 'required' => true, 'attr' => array('data-placeholder' => 'выберите')))->add($builder->create('graduateYear', 'choice', array('label' => 'Год окончания', 'required' => true, 'choices' => $years, 'empty_value' => 'выберите', 'attr' => array('data-placeholder' => 'выберите')))->addModelTransformer($yearToNumberTransformer))->add('job', null, array('label' => 'Место работы', 'required' => true, 'attr' => array('class' => 'input-document')))->add('phone', null, array('label' => 'Контактный телефон', 'required' => true))->add('scanDiplom', 'iphp_file', array('label' => 'Диплом ВУЗа', 'required' => true, 'error_bubbling' => false, 'constraints' => new NotBlank(array('message' => 'Укажите диплом ВУЗа'))))->add('scanSpecialist', 'iphp_file', array('label' => 'Сертификат специалиста', 'required' => true, 'error_bubbling' => false, 'constraints' => new NotBlank(array('message' => 'Укажите сертификат специалиста'))))->add('username', null, array('label' => 'E-mail', 'required' => true))->add('password', 'repeated', array('type' => 'password', 'invalid_message' => 'Пароли должны совпадать', 'options' => array('attr' => array('class' => 'password-field')), 'required' => true, 'first_options' => array('label' => 'Пароль'), 'second_options' => array('label' => 'Повторите пароль'), 'constraints' => new Length(array('min' => 6, 'max' => 50, 'minMessage' => "Пароль не может быть короче {{ limit }} символов", 'maxMessage' => "Пароль не может быть длиннее {{ limit }} символов"))))->add('eula', 'checkbox', array('label' => 'Я согласен(на) c <a target="_blank" href="/eula">пользовательским соглашением</a>', 'required' => true, 'mapped' => false, 'constraints' => new True(array('message' => 'Пожалуйста, подтвердите что вы согласны с пользовательским соглашением'))))->add('submit', 'submit', array('label' => 'ОТПРАВИТЬ', 'attr' => array('class' => 'btn-red')))->add('hash', 'hidden', array());
 }
示例#29
0
 /**
  * Adds fields with their types and validation constraints to this definition.
  *
  * This method is automatically called by the Form Factory builder and does not need
  * to be called manually, see the class description for usage information.
  *
  * @param FormBuilderInterface $builder
  * @param array                $options
  *
  * @return void
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     list($continents, $cities) = $this->getListOfTimezoneContinentsAndCities();
     $timezone = null;
     if (isset($options['data'])) {
         $timezone = $options['data']->getFullTimezone();
     }
     $dateTransformer = new DateTransformer($timezone);
     $builder->add('addr', 'hidden', ['mapped' => false])->add('name', 'text', ['constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 5])]])->add('description', 'textarea', ['constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 5])], 'attr' => ['rows' => '10']])->add($builder->create('tags', 'text', ['required' => false, 'attr' => ['placeholder' => 'comma separated, tag, list']])->addViewTransformer(new EventTagsTransformer()))->add('tz_continent', 'choice', ['label' => 'Timezone', 'choices' => array("Select a continent") + $continents, 'constraints' => [new Assert\NotBlank()]])->add('tz_place', 'choice', ['label' => 'Timezone city', 'choices' => array('Select a city') + $cities, 'constraints' => [new Assert\NotBlank()]])->add($builder->create('start_date', 'text', $this->getOptionsForDateWidget('Start date'))->addViewTransformer($dateTransformer))->add($builder->create('end_date', 'text', $this->getOptionsForDateWidget('End date'))->addViewTransformer($dateTransformer))->add('href', 'url', $this->getOptionsForUrlWidget('Website URL'))->add($builder->create('cfp_start_date', 'text', $this->getOptionsForDateWidget('Opening date', false))->addViewTransformer($dateTransformer))->add($builder->create('cfp_end_date', 'text', $this->getOptionsForDateWidget('Closing date', false))->addViewTransformer($dateTransformer))->add('cfp_url', 'url', $this->getOptionsForUrlWidget('Call for papers URL', false))->add('location', 'text', ['label' => 'Venue name', 'constraints' => [new Assert\NotBlank()]])->add('latitude', 'text', ['label' => 'Latitude', 'attr' => ['readonly' => 'readonly']])->add('longitude', 'text', ['label' => 'Longitude', 'attr' => ['readonly' => 'readonly']]);
 }
示例#30
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('content' => 'html', 'customHtml' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('email.email', $options));
     $variantParent = $options['data']->getVariantParent();
     $isVariant = !empty($variantParent);
     $builder->add('name', 'text', array('label' => 'mautic.email.form.internal.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $emojiTransformer = new EmojiToShortTransformer();
     $builder->add($builder->create('subject', 'text', array('label' => 'mautic.email.subject', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false))->addModelTransformer($emojiTransformer));
     $builder->add('fromName', 'text', array('label' => 'mautic.email.from_name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'preaddon' => 'fa fa-user', 'tooltip' => 'mautic.email.from_name.tooltip'), 'required' => false));
     $builder->add('fromAddress', 'text', array('label' => 'mautic.email.from_email', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'preaddon' => 'fa fa-envelope', 'tooltip' => 'mautic.email.from_email.tooltip'), 'required' => false));
     $builder->add('replyToAddress', 'text', array('label' => 'mautic.email.reply_to_email', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'preaddon' => 'fa fa-envelope', 'tooltip' => 'mautic.email.reply_to_email.tooltip'), 'required' => false));
     $builder->add('bccAddress', 'text', array('label' => 'mautic.email.bcc', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'preaddon' => 'fa fa-envelope', 'tooltip' => 'mautic.email.bcc.tooltip'), 'required' => false));
     $builder->add('template', 'theme_list', array('feature' => 'email', 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.form.template.help', 'onchange' => 'Mautic.onBuilderModeSwitch(this);'), 'empty_value' => 'mautic.core.none'));
     $builder->add('isPublished', 'yesno_button_group');
     $builder->add('publishUp', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('publishDown', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('plainText', 'textarea', array('label' => 'mautic.email.form.plaintext', 'label_attr' => array('class' => 'control-label'), 'attr' => array('tooltip' => 'mautic.email.form.plaintext.help', 'class' => 'form-control', 'rows' => '15', 'data-token-callback' => 'email:getBuilderTokens', 'data-token-activator' => '{', 'data-token-visual' => 'false'), 'required' => false));
     $url = $this->request->getSchemeAndHttpHost() . $this->request->getBasePath();
     $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use($url) {
         $parser = new PlainTextHelper(array('base_url' => $url));
         $data = $event->getData();
         // Then strip out HTML
         $data['plainText'] = $parser->setHtml($data['plainText'])->getText();
         $event->setData($data);
     });
     $builder->add($builder->create('customHtml', 'textarea', array('label' => 'mautic.email.form.body', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control editor-fullpage editor-builder-tokens', 'data-token-callback' => 'email:getBuilderTokens', 'data-token-activator' => '{')))->addModelTransformer($emojiTransformer));
     $transformer = new IdToEntityModelTransformer($this->em, 'MauticFormBundle:Form', 'id');
     $builder->add($builder->create('unsubscribeForm', 'form_list', array('label' => 'mautic.email.form.unsubscribeform', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tootlip' => 'mautic.email.form.unsubscribeform.tooltip', 'data-placeholder' => $this->translator->trans('mautic.core.form.chooseone')), 'required' => false, 'multiple' => false, 'empty_value' => ''))->addModelTransformer($transformer));
     if ($isVariant) {
         $builder->add('variantSettings', 'emailvariant', array('label' => false));
     } else {
         //add category
         $builder->add('category', 'category', array('bundle' => 'email'));
         //add lead lists
         $transformer = new IdToEntityModelTransformer($this->em, 'MauticLeadBundle:LeadList', 'id', true);
         $builder->add($builder->create('lists', 'leadlist_choices', array('label' => 'mautic.email.form.list', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'multiple' => true, 'expanded' => false, 'required' => true))->addModelTransformer($transformer));
         $builder->add('language', 'locale', array('label' => 'mautic.core.language', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     }
     //add lead lists
     $transformer = new IdToEntityModelTransformer($this->em, 'MauticAssetBundle:Asset', 'id', true);
     $builder->add($builder->create('assetAttachments', 'asset_list', array('label' => 'mautic.email.attachments', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'onchange' => 'Mautic.getTotalAttachmentSize();'), 'multiple' => true, 'expanded' => false))->addModelTransformer($transformer));
     $builder->add('sessionId', 'hidden');
     $builder->add('emailType', 'hidden');
     $customButtons = array(array('name' => 'builder', 'label' => 'mautic.core.builder', 'attr' => array('class' => 'btn btn-default btn-dnd btn-nospin text-primary btn-builder', 'icon' => 'fa fa-cube', 'onclick' => "Mautic.launchBuilder('emailform', 'email');")));
     if (!empty($options['update_select'])) {
         $builder->add('buttons', 'form_buttons', array('apply_text' => false, 'pre_extra_buttons' => $customButtons));
         $builder->add('updateSelect', 'hidden', array('data' => $options['update_select'], 'mapped' => false));
     } else {
         $builder->add('buttons', 'form_buttons', array('pre_extra_buttons' => $customButtons));
     }
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }