当前位置: 首页>>代码示例>>PHP>>正文


PHP FormBuilderInterface::addEventSubscriber方法代码示例

本文整理汇总了PHP中Symfony\Component\Form\FormBuilderInterface::addEventSubscriber方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilderInterface::addEventSubscriber方法的具体用法?PHP FormBuilderInterface::addEventSubscriber怎么用?PHP FormBuilderInterface::addEventSubscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Form\FormBuilderInterface的用法示例。


在下文中一共展示了FormBuilderInterface::addEventSubscriber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('description' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('form.form', $options));
     //details
     $builder->add('name', 'text', array('label' => 'mautic.core.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.core.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control editor'), 'required' => false));
     //add category
     $builder->add('category', 'category', array('bundle' => 'form'));
     $builder->add('template', 'theme_list', array('feature' => 'form', 'empty_value' => ' ', 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.form.form.template.help')));
     if (!empty($options['data']) && $options['data']->getId()) {
         $readonly = !$this->security->hasEntityAccess('form:forms:publishown', 'form:forms:publishother', $options['data']->getCreatedBy());
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('form:forms:publishown')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = true;
     }
     $builder->add('isPublished', 'yesno_button_group', array('read_only' => $readonly, 'data' => $data));
     $builder->add('inKioskMode', 'yesno_button_group', array('label' => 'mautic.form.form.kioskmode', 'attr' => array('tooltip' => 'mautic.form.form.kioskmode.tooltip')));
     $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('postAction', 'choice', array('choices' => array('return' => 'mautic.form.form.postaction.return', 'redirect' => 'mautic.form.form.postaction.redirect', 'message' => 'mautic.form.form.postaction.message'), 'label' => 'mautic.form.form.postaction', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'onchange' => 'Mautic.onPostSubmitActionChange(this.value);'), 'required' => false, 'empty_value' => false));
     $postAction = isset($options['data']) ? $options['data']->getPostAction() : '';
     $required = in_array($postAction, array('redirect', 'message')) ? true : false;
     $builder->add('postActionProperty', 'text', array('label' => 'mautic.form.form.postactionproperty', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => $required));
     $builder->add('sessionId', 'hidden', array('mapped' => false));
     $builder->add('buttons', 'form_buttons');
     $builder->add('formType', 'hidden');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
开发者ID:woakes070048,项目名称:mautic,代码行数:38,代码来源:FormType.php

示例2: buildForm

 /**
  * @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']);
     }
 }
开发者ID:Yame-,项目名称:mautic,代码行数:29,代码来源:DynamicContentType.php

示例3: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('content' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('category.category', $options));
     if ($options['data']->getId()) {
         // Edit existing category from category manager - do not allow to edit bundle
         $builder->add('bundle', 'hidden', array('data' => $options['data']->getBundle()));
     } elseif ($options['show_bundle_select'] == true) {
         // Create new category from category bundle - let user select the bundle
         $selected = $this->session->get('mautic.category.type', 'category');
         $builder->add('bundle', 'category_bundles_form', array('label' => 'mautic.core.type', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => true, 'data' => $selected));
     } else {
         // Create new category directly from another bundle - preset bundle
         $builder->add('bundle', 'hidden', array('data' => $options['bundle']));
     }
     $builder->add('title', 'text', array('label' => 'mautic.core.title', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'text', array('label' => 'mautic.core.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     $builder->add('alias', 'text', array('label' => 'mautic.core.alias', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.category.form.alias.help'), 'required' => false));
     $builder->add('color', 'text', array('label' => 'mautic.core.color', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'color'), 'required' => false));
     $builder->add('isPublished', 'yesno_button_group');
     $builder->add('inForm', 'hidden', array('mapped' => false));
     $builder->add('buttons', 'form_buttons');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:30,代码来源:CategoryType.php

示例4: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $propertyPathToComune = 'comune';
     $builder->addEventSubscriber(new AddComuneFieldSubscriber($propertyPathToComune));
     $builder->addEventSubscriber(new AddProvinciaeFieldSubscriber($propertyPathToComune));
     $builder->addEventSubscriber(new AddRegioneFieldSubscriber($propertyPathToComune));
 }
开发者ID:sourcevx,项目名称:Test,代码行数:11,代码来源:LocalitaType.php

示例5: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['content' => 'html', 'customHtml' => 'html']));
     $builder->addEventSubscriber(new FormExitSubscriber('notification.notification', $options));
     $builder->add('name', 'text', ['label' => 'mautic.notification.form.internal.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('description', 'textarea', ['label' => 'mautic.notification.form.internal.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
     $builder->add('heading', 'text', ['label' => 'mautic.notification.form.heading', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('message', 'textarea', ['label' => 'mautic.notification.form.message', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 6]]);
     $builder->add('url', 'url', ['label' => 'mautic.notification.form.url', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.notification.form.url.tooltip'], 'required' => false]);
     $builder->add('isPublished', 'yesno_button_group');
     $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]);
     //add category
     $builder->add('category', 'category', ['bundle' => 'notification']);
     $builder->add('language', 'locale', ['label' => 'mautic.core.language', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
     $builder->add('buttons', 'form_buttons');
     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']);
     }
 }
开发者ID:Yame-,项目名称:mautic,代码行数:30,代码来源:NotificationType.php

示例6: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('description' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('campaign', $options));
     $builder->add('name', 'text', array('label' => 'mautic.core.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.core.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control editor'), 'required' => false));
     //add category
     $builder->add('category', 'category', array('bundle' => 'campaign'));
     if (!empty($options['data']) && $options['data']->getId()) {
         $readonly = !$this->security->isGranted('campaign:campaigns:publish');
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('campaign:campaigns:publish')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = false;
     }
     $builder->add('isPublished', 'yesno_button_group', array('read_only' => $readonly, 'data' => $data));
     $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('sessionId', 'hidden', array('mapped' => false));
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
     $builder->add('buttons', 'form_buttons', array('pre_extra_buttons' => array(array('name' => 'builder', 'label' => 'mautic.campaign.campaign.launch.builder', 'attr' => array('class' => 'btn btn-default btn-dnd', 'icon' => 'fa fa-cube', 'onclick' => "Mautic.launchCampaignEditor();")))));
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:31,代码来源:CampaignType.php

示例7: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber());
     $builder->addEventSubscriber(new FormExitSubscriber('user.user', $options));
     $builder->add('username', 'text', array('label' => 'mautic.core.username', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'preaddon' => 'fa fa-user', 'autocomplete' => 'off')));
     $builder->add('firstName', 'text', array('label' => 'mautic.core.firstname', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('lastName', 'text', array('label' => 'mautic.core.lastname', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $positions = $this->model->getLookupResults('position', null, 0, true);
     $builder->add('position', 'text', array('label' => 'mautic.core.position', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-options' => json_encode($positions)), 'required' => false));
     $builder->add('email', 'email', array('label' => 'mautic.core.type.email', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'preaddon' => 'fa fa-envelope')));
     $existing = !empty($options['data']) && $options['data']->getId();
     $placeholder = $existing ? $this->translator->trans('mautic.user.user.form.passwordplaceholder') : '';
     $required = $existing ? false : true;
     $builder->add('plainPassword', 'repeated', array('first_name' => 'password', 'first_options' => array('label' => 'mautic.core.password', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => $placeholder, 'tooltip' => 'mautic.user.user.form.help.passwordrequirements', 'preaddon' => 'fa fa-lock', 'autocomplete' => 'off'), 'required' => $required, 'error_bubbling' => false), 'second_name' => 'confirm', 'second_options' => array('label' => 'mautic.user.user.form.passwordconfirm', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => $placeholder, 'tooltip' => 'mautic.user.user.form.help.passwordrequirements', 'preaddon' => 'fa fa-lock', 'autocomplete' => 'off'), 'required' => $required, 'error_bubbling' => false), 'type' => 'password', 'invalid_message' => 'mautic.user.user.password.mismatch', 'required' => $required, 'error_bubbling' => false));
     $builder->add('timezone', 'timezone', array('label' => 'mautic.core.timezone', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'multiple' => false, 'empty_value' => 'mautic.user.user.form.defaulttimezone'));
     $builder->add('locale', 'choice', array('choices' => $this->supportedLanguages, 'label' => 'mautic.core.language', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'multiple' => false, 'empty_value' => 'mautic.user.user.form.defaultlocale'));
     if (empty($options['in_profile'])) {
         $builder->add($builder->create('role', 'entity', array('label' => 'mautic.user.role', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'class' => 'MauticUserBundle:Role', 'property' => 'name', 'query_builder' => function (EntityRepository $er) {
             return $er->createQueryBuilder('r')->where('r.isPublished = true')->orderBy('r.name', 'ASC');
         })));
         $builder->add('isPublished', 'yesno_button_group');
         $builder->add('buttons', 'form_buttons');
     } else {
         $builder->add('buttons', 'form_buttons', array('save_text' => 'mautic.core.form.apply', 'apply_text' => false));
     }
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:32,代码来源:UserType.php

示例8: buildForm

 /**
  * @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('sms.sms', $options));
     $builder->add('name', 'text', array('label' => 'mautic.sms.form.internal.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.sms.form.internal.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     $builder->add('message', 'textarea', array('label' => 'mautic.sms.form.message', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'rows' => 6)));
     $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));
     //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.sms.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));
     $builder->add('buttons', 'form_buttons');
     $builder->add('smsType', 'hidden');
     if (!empty($options['update_select'])) {
         $builder->add('buttons', 'form_buttons', array('apply_text' => false));
         $builder->add('updateSelect', 'hidden', array('data' => $options['update_select'], 'mapped' => false));
     } else {
         $builder->add('buttons', 'form_buttons');
     }
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
开发者ID:HomeRefill,项目名称:mautic,代码行数:38,代码来源:SmsType.php

示例9: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber($this->projectFieldSubscriber);
     $builder->addEventSubscriber($this->ActivityFieldSubscriber);
     $builder->add('task', 'text');
     $builder->add('totalHours', 'text');
 }
开发者ID:pavsuri,项目名称:PARMT,代码行数:7,代码来源:UserDashBoardForm.php

示例10: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('content' => 'html', 'customHtml' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('page.page', $options));
     $variantParent = $options['data']->getVariantParent();
     $isVariant = !empty($variantParent);
     $builder->add('title', 'text', array('label' => 'mautic.core.title', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('customHtml', 'textarea', array('label' => 'mautic.page.form.customhtml', 'required' => false, 'attr' => array('class' => 'form-control editor-fullpage editor-builder-tokens', 'data-token-callback' => 'page:getBuilderTokens', 'data-token-activator' => '{')));
     $template = $options['data']->getTemplate();
     if (empty($template)) {
         $template = $this->defaultTheme;
     }
     $builder->add('template', 'theme_list', array('feature' => 'page', 'data' => $template, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.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('sessionId', 'hidden');
     if ($isVariant) {
         $builder->add('variantSettings', 'pagevariant', array('label' => false, 'page_entity' => $options['data'], 'data' => $options['data']->getVariantSettings()));
     } else {
         $builder->add('metaDescription', 'textarea', array('label' => 'mautic.page.form.metadescription', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'maxlength' => 160), 'required' => false));
         $builder->add('alias', 'text', array('label' => 'mautic.core.alias', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.help.alias'), 'required' => false, 'disabled' => $isVariant));
         //add category
         $builder->add('category', 'category', array('bundle' => 'page', 'disabled' => $isVariant));
         $builder->add('language', 'locale', array('label' => 'mautic.core.language', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.language.help'), 'required' => false, 'disabled' => $isVariant));
         $transformer = new \Mautic\CoreBundle\Form\DataTransformer\IdToEntityModelTransformer($this->em, 'MauticPageBundle:Page', 'id');
         $builder->add($builder->create('translationParent', 'page_list', array('label' => 'mautic.page.form.translationparent', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.translationparent.help'), 'required' => false, 'multiple' => false, 'empty_value' => 'mautic.page.form.translationparent.empty', 'disabled' => $isVariant, 'top_level' => 'translation', 'ignore_ids' => array((int) $options['data']->getId())))->addModelTransformer($transformer));
     }
     $builder->add('buttons', 'form_buttons', array('pre_extra_buttons' => array(array('name' => 'builder', 'label' => 'mautic.core.builder', 'attr' => array('class' => 'btn btn-default btn-dnd btn-nospin btn-builder text-primary', 'icon' => 'fa fa-cube', 'onclick' => "Mautic.launchBuilder('page');")))));
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
开发者ID:woakes070048,项目名称:mautic,代码行数:36,代码来源:PageType.php

示例11: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber());
     $builder->addEventSubscriber(new FormExitSubscriber('lead.field', $options));
     $builder->add('label', 'text', array('label' => 'mautic.lead.field.label', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'length' => 50)));
     $disabled = !empty($options['data']) ? $options['data']->isFixed() : false;
     $builder->add('group', 'choice', array('choices' => array('core' => 'mautic.lead.field.group.core', 'social' => 'mautic.lead.field.group.social', 'personal' => 'mautic.lead.field.group.personal', 'professional' => 'mautic.lead.field.group.professional'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.lead.field.form.group.help'), 'expanded' => false, 'multiple' => false, 'label' => 'mautic.lead.field.group', 'empty_value' => false, 'required' => false, 'disabled' => $disabled));
     $new = !empty($options['data']) && $options['data']->getAlias() ? false : true;
     $default = $new ? 'text' : $options['data']->getType();
     $fieldHelper = new FormFieldHelper();
     $fieldHelper->setTranslator($this->translator);
     $builder->add('type', 'choice', array('choices' => $fieldHelper->getChoiceList(), 'expanded' => false, 'multiple' => false, 'label' => 'mautic.lead.field.type', 'empty_value' => false, 'disabled' => $disabled || !$new, 'attr' => array('class' => 'form-control', 'onchange' => 'Mautic.updateLeadFieldProperties(this.value);'), 'data' => $default, 'required' => false));
     $builder->add('properties', 'collection', array('required' => false, 'allow_add' => true, 'error_bubbling' => false));
     $builder->add('defaultValue', 'text', array('label' => 'mautic.core.defaultvalue', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     //get order list
     $transformer = new FieldToOrderTransformer($this->em);
     $builder->add($builder->create('order', 'entity', array('label' => 'mautic.core.order', 'class' => 'MauticLeadBundle:LeadField', 'property' => 'label', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('f')->orderBy('f.order', 'ASC');
     }, 'required' => false))->addModelTransformer($transformer));
     $builder->add('alias', 'text', array('label' => 'mautic.core.alias', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'length' => 25, 'tooltip' => 'mautic.lead.field.help.alias'), 'required' => false, 'disabled' => $disabled || !$new));
     $data = $disabled ? true : $options['data']->getIsPublished();
     $builder->add('isPublished', 'yesno_button_group', array('disabled' => $disabled, 'data' => $data));
     $builder->add('isRequired', 'yesno_button_group', array('label' => 'mautic.core.required'));
     $builder->add('isVisible', 'yesno_button_group', array('label' => 'mautic.lead.field.form.isvisible'));
     $builder->add('isShortVisible', 'yesno_button_group', array('label' => 'mautic.lead.field.form.isshortvisible'));
     $builder->add('isListable', 'yesno_button_group', array('label' => 'mautic.lead.field.form.islistable'));
     $builder->add('isUniqueIdentifer', 'yesno_button_group', array('label' => 'mautic.lead.field.form.isuniqueidentifer', 'attr' => array('tooltip' => 'mautic.lead.field.form.isuniqueidentifer.tooltip')));
     $builder->add('isPubliclyUpdatable', 'yesno_button_group', array('label' => 'mautic.lead.field.form.ispubliclyupdatable', 'attr' => array('tooltip' => 'mautic.lead.field.form.ispubliclyupdatable.tooltip')));
     $builder->add('buttons', 'form_buttons');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
开发者ID:woakes070048,项目名称:mautic,代码行数:37,代码来源:FieldType.php

示例12: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('description' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('point', $options));
     $builder->add('name', 'text', array('label' => 'mautic.core.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.core.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control editor'), 'required' => false));
     //add category
     $builder->add('category', 'category', array('bundle' => 'point'));
     $builder->add('points', 'number', array('label' => 'mautic.point.trigger.form.points', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.point.trigger.form.points_descr'), 'required' => false));
     $color = $options['data']->getColor();
     $builder->add('color', 'text', array('label' => 'mautic.point.trigger.form.color', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'color', 'tooltip' => 'mautic.point.trigger.form.color_descr'), 'required' => false, 'data' => !empty($color) ? $color : 'a0acb8', 'empty_data' => 'a0acb8'));
     $builder->add('triggerExistingLeads', 'yesno_button_group', array('label' => 'mautic.point.trigger.form.existingleads'));
     if (!empty($options['data']) && $options['data']->getId()) {
         $readonly = !$this->security->isGranted('point:triggers:publish');
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('point:triggers:publish')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = false;
     }
     $builder->add('isPublished', 'yesno_button_group', array('read_only' => $readonly, 'data' => $data));
     $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('sessionId', 'hidden', array('mapped' => false));
     $builder->add('buttons', 'form_buttons');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
开发者ID:Yame-,项目名称:mautic,代码行数:34,代码来源:TriggerType.php

示例13: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['description' => 'html']));
     $builder->addEventSubscriber(new FormExitSubscriber('stage', $options));
     $builder->add('description', 'textarea', ['label' => 'mautic.core.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control editor'], 'required' => false]);
     $builder->add('name', 'text', ['label' => 'mautic.core.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('weight', 'number', ['label' => 'mautic.stage.action.weight', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.stage.action.weight.help'], 'precision' => 0, 'required' => false]);
     if (!empty($options['data']) && $options['data'] instanceof Stage) {
         $readonly = !$this->security->hasEntityAccess('stage:stages:publishown', 'stage:stages:publishother', $options['data']->getCreatedBy());
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('stage:stages:publishown')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = true;
     }
     $builder->add('isPublished', 'yesno_button_group', ['read_only' => $readonly, 'data' => $data]);
     $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]);
     //add category
     $builder->add('category', 'category', ['bundle' => 'stage']);
     $builder->add('buttons', 'form_buttons');
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:30,代码来源:StageType.php

示例14: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('subTotal', 'oro_money', ['required' => false]);
     $builder->add('grandTotal', 'oro_money', ['required' => false]);
     $builder->add('taxAmount', 'oro_money', ['required' => false]);
     $builder->add('cartItems', 'orocrm_cart_item_collection', ['label' => '', 'type' => 'cart_item_api_type', 'required' => true, 'options' => ['data_class' => 'OroCRM\\Bundle\\MagentoBundle\\Entity\\CartItem']]);
     $builder->add('customer', 'orocrm_customer_select', ['required' => false]);
     $builder->add('store', 'translatable_entity', ['class' => 'OroCRMMagentoBundle:Store', 'property' => 'name']);
     $builder->add('itemsQty', 'number', ['required' => true]);
     $builder->add('baseCurrencyCode', 'text', ['required' => true]);
     $builder->add('storeCurrencyCode', 'text', ['required' => true]);
     $builder->add('quoteCurrencyCode', 'text', ['required' => true]);
     $builder->add('storeToBaseRate', 'number', ['required' => true]);
     $builder->add('storeToQuoteRate', 'number', ['required' => false]);
     $builder->add('email', 'text', ['required' => false]);
     $builder->add('giftMessage', 'text', ['required' => false]);
     $builder->add('isGuest', 'checkbox', ['required' => true]);
     $builder->add('shippingAddress', 'cart_address_api_type');
     $builder->add('billingAddress', 'cart_address_api_type');
     $builder->add('paymentDetails', 'text', ['required' => false]);
     $builder->add('status', 'translatable_entity', ['class' => 'OroCRMMagentoBundle:CartStatus', 'property' => 'name']);
     $builder->add('notes', 'text', ['required' => false]);
     $builder->add('statusMessage', 'text', ['required' => false]);
     $builder->add('owner', 'translatable_entity', ['class' => 'Oro\\Bundle\\UserBundle\\Entity\\User', 'property' => 'username', 'required' => false]);
     $builder->add('dataChannel', 'translatable_entity', ['class' => 'OroCRMChannelBundle:Channel', 'property' => 'name', 'required' => false]);
     $builder->add('channel', 'oro_integration_select');
     $builder->add('originId', 'number', ['required' => false]);
     $builder->addEventSubscriber(new PatchSubscriber());
     $builder->addEventSubscriber(new CartApiFormSubscriber());
 }
开发者ID:antrampa,项目名称:crm,代码行数:33,代码来源:CartApiType.php

示例15: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('sku', 'text', ['required' => true]);
     $builder->add('name', 'text', ['required' => true]);
     $builder->add('qty', 'number', ['required' => true]);
     $builder->add('price', 'oro_money', ['required' => true]);
     $builder->add('discountAmount', 'oro_money', ['required' => true]);
     $builder->add('taxPercent', 'oro_percent', ['required' => true]);
     $builder->add('weight', 'number', ['required' => false]);
     $builder->add('productId', 'number', ['required' => true]);
     $builder->add('parentItemId', 'number', ['required' => false]);
     $builder->add('freeShipping', 'text', ['required' => true]);
     $builder->add('taxAmount', 'oro_money', ['required' => false]);
     $builder->add('giftMessage', 'text', ['required' => false]);
     $builder->add('taxClassId', 'text', ['required' => false]);
     $builder->add('description', 'text', ['required' => false]);
     $builder->add('isVirtual', 'checkbox', ['required' => true]);
     $builder->add('customPrice', 'oro_money', ['required' => false]);
     $builder->add('priceInclTax', 'oro_money', ['required' => false]);
     $builder->add('rowTotal', 'oro_money', ['required' => true]);
     $builder->add('productType', 'text', ['required' => true]);
     $builder->add('cart', 'orocrm_cart_select', ['required' => false]);
     $builder->addEventSubscriber(new PatchSubscriber());
     $builder->addEventSubscriber(new CartItemApiFormSubscriber());
 }
开发者ID:antrampa,项目名称:crm,代码行数:28,代码来源:CartItemsApiType.php


注:本文中的Symfony\Component\Form\FormBuilderInterface::addEventSubscriber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。