Beispiel #1
0
 /**
  * {@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"]);
     }
 }
Beispiel #2
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']);
     }
 }
 /**
  * @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"]);
     }
 }
Beispiel #4
0
 /**
  * @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));
 }
Beispiel #5
0
 /**
  * @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']);
     }
 }
 /**
  * @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();")))));
 }
Beispiel #7
0
 /**
  * {@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"]);
     }
 }
Beispiel #8
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('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"]);
     }
 }
Beispiel #9
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber($this->projectFieldSubscriber);
     $builder->addEventSubscriber($this->ActivityFieldSubscriber);
     $builder->add('task', 'text');
     $builder->add('totalHours', 'text');
 }
Beispiel #10
0
 /**
  * {@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']);
     }
 }
Beispiel #11
0
 /**
  * @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"]);
     }
 }
Beispiel #12
0
 /**
  * {@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"]);
     }
 }
Beispiel #13
0
 /**
  * {@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']);
     }
 }
Beispiel #14
0
 /**
  * {@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());
 }
Beispiel #15
0
 /**
  * {@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());
 }
Beispiel #16
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('notification.notification', $options));
     $builder->add('name', 'text', array('label' => 'mautic.notification.form.internal.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.notification.form.internal.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     $builder->add('heading', 'text', array('label' => 'mautic.notification.form.heading', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('message', 'textarea', array('label' => 'mautic.notification.form.message', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'rows' => 6)));
     $builder->add('url', 'url', array('label' => 'mautic.notification.form.url', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.notification.form.url.tooltip'), 'required' => false));
     $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.notification.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('notificationType', '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('notificationform', 'notification');")));
     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"]);
     }
 }
Beispiel #17
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['description' => 'html']));
     $builder->addEventSubscriber(new FormExitSubscriber('point', $options));
     $builder->add('name', 'text', ['label' => 'mautic.core.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('description', 'textarea', ['label' => 'mautic.core.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control editor'], 'required' => false]);
     $builder->add('type', 'choice', ['choices' => $options['pointActions']['choices'], 'empty_value' => '', 'label' => 'mautic.point.form.type', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'onchange' => 'Mautic.getPointActionPropertiesForm(this.value);']]);
     $builder->add('delta', 'number', ['label' => 'mautic.point.action.delta', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.point.action.delta.help'], 'precision' => 0]);
     $type = !empty($options['actionType']) ? $options['actionType'] : $options['data']->getType();
     if ($type) {
         $formType = !empty($options['pointActions']['actions'][$type]['formType']) ? $options['pointActions']['actions'][$type]['formType'] : 'genericpoint_settings';
         $properties = $options['data'] ? $options['data']->getProperties() : [];
         $builder->add('properties', $formType, ['label' => false, 'data' => $properties]);
     }
     if (!empty($options['data']) && $options['data'] instanceof Point) {
         $readonly = !$this->security->hasEntityAccess('point:points:publishown', 'point:points:publishother', $options['data']->getCreatedBy());
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('point:points: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' => 'point']);
     $builder->add('buttons', 'form_buttons');
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Beispiel #18
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['website' => 'url']));
     $builder->addEventSubscriber(new FormExitSubscriber('focus', $options));
     $builder->add('name', 'text', ['label' => 'mautic.core.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('description', 'textarea', ['label' => 'mautic.core.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control editor'], 'required' => false]);
     $builder->add('website', 'url', ['label' => 'mautic.focus.form.website', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.focus.form.website.tooltip'], 'required' => false]);
     //add category
     $builder->add('category', 'category', ['bundle' => 'plugin:focus']);
     if (!empty($options['data']) && $options['data']->getId()) {
         $readonly = !$this->security->isGranted('plugin:focus:items:publish');
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('plugin:focus:items:publish')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = false;
     }
     $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]);
     $builder->add('properties', 'focus_entity_properties', ['data' => $options['data']->getProperties()]);
     // Will be managed by JS
     $builder->add('type', 'hidden');
     $builder->add('style', 'hidden');
     $builder->add('form', 'form_list', ['label' => 'mautic.focus.form.choose_form', 'multiple' => false, 'empty_value' => '', 'attr' => ['onchange' => 'Mautic.focusUpdatePreview()']]);
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
     $builder->add('buttons', 'form_buttons', ['pre_extra_buttons' => [['name' => 'builder', 'label' => 'mautic.core.builder', 'attr' => ['class' => 'btn btn-default btn-dnd btn-nospin', 'icon' => 'fa fa-cube', 'onclick' => 'Mautic.launchFocusBuilder();']]]]);
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $factory = $builder->getFormFactory();
     $builder->addEventSubscriber(new AddPaisFieldSubscriber($factory));
     $builder->addEventSubscriber(new AddProvinciaFieldSubscriber($factory));
     $builder->addEventSubscriber(new AddDepartamentoFieldSubscriber($factory));
     $builder->addEventSubscriber(new AddLocalidadFieldSubscriber($factory));
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if ($options['single_form'] && $options['all_addresses_property_path']) {
         $builder->addEventSubscriber(new FixAddressesPrimarySubscriber($options['all_addresses_property_path']));
         $builder->addEventSubscriber(new FixCustomerAddressesDefaultSubscriber($options['all_addresses_property_path']));
     }
     $builder->add('types', 'translatable_entity', ['class' => $this->addressTypeDataClass, 'property' => 'label', 'required' => false, 'multiple' => true, 'expanded' => true])->add('defaults', CustomerTypedAddressWithDefaultType::NAME, ['class' => $this->addressTypeDataClass, 'required' => false])->add('primary', 'checkbox', ['required' => false]);
 }
Beispiel #21
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if ($options['single_form'] && $options['all_addresses_property_path']) {
         $builder->addEventSubscriber(new FixAddressesPrimarySubscriber($options['all_addresses_property_path']));
         $builder->addEventSubscriber(new FixAddressesTypesSubscriber($options['all_addresses_property_path']));
     }
     $builder->add('types', 'translatable_entity', array('class' => 'OroAddressBundle:AddressType', 'property' => 'label', 'required' => false, 'multiple' => true, 'expanded' => true))->add('primary', 'checkbox', array('required' => false));
 }
Beispiel #22
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber());
     $builder->addEventSubscriber(new FormExitSubscriber('api.client', $options));
     if (!$options['data']->getId()) {
         $builder->add('api_mode', 'choice', array('mapped' => false, 'label' => 'mautic.api.client.form.auth_protocol', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'onchange' => 'Mautic.refreshApiClientForm(\'' . $this->router->generate('mautic_client_action', array('objectAction' => 'new')) . '\', this)'), 'choices' => array('oauth1a' => 'OAuth 1.0a', 'oauth2' => 'OAuth 2'), 'required' => false, 'empty_value' => false, 'data' => $this->apiMode));
     }
     $builder->add('name', 'text', array('label' => 'mautic.core.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     if ($this->apiMode == 'oauth2') {
         $arrayStringTransformer = new Transformers\ArrayStringTransformer();
         $builder->add($builder->create('redirectUris', 'text', array('label' => 'mautic.api.client.redirecturis', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.api.client.form.help.requesturis')))->addViewTransformer($arrayStringTransformer));
         $builder->add('publicId', 'text', array('label' => 'mautic.api.client.form.clientid', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'disabled' => true, 'required' => false, 'mapped' => false, 'data' => $options['data']->getPublicId()));
         $builder->add('secret', 'text', array('label' => 'mautic.api.client.form.clientsecret', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'disabled' => true, 'required' => false));
         $translator = $this->translator;
         $validator = $this->validator;
         $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use($translator, $validator) {
             $form = $event->getForm();
             $data = $event->getData();
             if ($form->has('redirectUris')) {
                 foreach ($data->getRedirectUris() as $uri) {
                     $urlConstraint = new OAuthCallback();
                     $urlConstraint->message = $translator->trans('mautic.api.client.redirecturl.invalid', array('%url%' => $uri), 'validators');
                     $errors = $validator->validateValue($uri, $urlConstraint);
                     if (!empty($errors)) {
                         foreach ($errors as $error) {
                             $form['redirectUris']->addError(new FormError($error->getMessage()));
                         }
                     }
                 }
             }
         });
     } else {
         $builder->add($builder->create('callback', 'text', array('label' => 'mautic.api.client.form.callback', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.api.client.form.help.callback'), 'required' => false))->addModelTransformer(new Transformers\NullToEmptyTransformer()));
         $builder->add('consumerKey', 'text', array('label' => 'mautic.api.client.form.consumerkey', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'onclick' => 'this.setSelectionRange(0, this.value.length);'), 'read_only' => true, 'required' => false, 'mapped' => false, 'data' => $options['data']->getConsumerKey()));
         $builder->add('consumerSecret', 'text', array('label' => 'mautic.api.client.form.consumersecret', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'onclick' => 'this.setSelectionRange(0, this.value.length);'), 'read_only' => true, 'required' => false));
         $translator = $this->translator;
         $validator = $this->validator;
         $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use($translator, $validator) {
             $form = $event->getForm();
             $data = $event->getData();
             if ($form->has('callback')) {
                 $uri = $data->getCallback();
                 $urlConstraint = new OAuthCallback();
                 $urlConstraint->message = $translator->trans('mautic.api.client.redirecturl.invalid', array('%url%' => $uri), 'validators');
                 $errors = $validator->validateValue($uri, $urlConstraint);
                 if (!empty($errors)) {
                     foreach ($errors as $error) {
                         $form['callback']->addError(new FormError($error->getMessage()));
                     }
                 }
             }
         });
     }
     $builder->add('buttons', 'form_buttons');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
Beispiel #23
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('realname', TextType::class, ['label' => false, 'attr' => ['class' => 'form-control', 'placeholder' => 'Фамилия, Имя']]);
     $factory = $builder->getFormFactory();
     $countrySubscriber = new AddCountryFieldSubscriber($factory);
     $builder->addEventSubscriber($countrySubscriber);
     $citySubscriber = new AddCityFieldSubscriber($factory);
     $builder->addEventSubscriber($citySubscriber);
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('name', 'text', array('label' => 'open_orchestra_backoffice.form.website.name', 'attr' => array('class' => 'generate-id-source'), 'group_id' => 'information', 'sub_group_id' => 'property'))->add('aliases', 'collection', array('type' => 'oo_site_alias', 'label' => false, 'allow_add' => true, 'allow_delete' => true, 'attr' => array('data-prototype-label-add' => $this->translator->trans('open_orchestra_backoffice.form.field_option.add'), 'data-prototype-label-new' => $this->translator->trans('open_orchestra_backoffice.form.field_option.new'), 'data-prototype-label-remove' => $this->translator->trans('open_orchestra_backoffice.form.field_option.delete')), 'options' => array('label' => false), 'group_id' => 'alias'))->add('blocks', 'oo_block_choice', array('multiple' => true, 'expanded' => true, 'label' => false, 'required' => false, 'group_id' => 'content', 'sub_group_id' => 'block'))->add('theme', 'oo_site_theme_choice', array('label' => 'open_orchestra_backoffice.form.website.theme', 'group_id' => 'template_set', 'sub_group_id' => 'property'))->add('metaAuthor', 'text', array('label' => 'open_orchestra_backoffice.form.website.metaAuthor', 'group_id' => 'seo', 'sub_group_id' => 'meta'))->add('sitemap_changefreq', 'orchestra_frequence_choice', array('label' => 'open_orchestra_backoffice.form.website.changefreq.title', 'attr' => array('help_text' => 'open_orchestra_backoffice.form.website.changefreq.helper'), 'group_id' => 'seo', 'sub_group_id' => 'sitemap'))->add('sitemap_priority', 'percent', array('label' => 'open_orchestra_backoffice.form.node.priority.label', 'type' => 'fractional', 'precision' => 2, 'attr' => array('help_text' => 'open_orchestra_backoffice.form.node.priority.helper'), 'group_id' => 'seo', 'sub_group_id' => 'sitemap'))->add('robotsTxt', 'textarea', array('label' => 'open_orchestra_backoffice.form.website.robots_txt', 'required' => true, 'group_id' => 'seo', 'sub_group_id' => 'robot'));
     $builder->addEventSubscriber(new WebSiteSubscriber());
     $builder->addEventSubscriber(new WebSiteNodeTemplateSubscriber($this->templateManager));
     if (array_key_exists('disabled', $options)) {
         $builder->setAttribute('disabled', $options['disabled']);
     }
 }
Beispiel #25
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('shopTags', 'text', array('label' => false, 'attr' => ['class' => 'form-control', 'placeholder' => 'Теги *']));
     $factory = $builder->getFormFactory();
     $countrySubscriber = new AddCountryFieldSubscriber($factory);
     $builder->addEventSubscriber($countrySubscriber);
     $citySubscriber = new AddCityFieldSubscriber($factory);
     $builder->addEventSubscriber($citySubscriber);
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('realname', TextType::class, ['label' => false, "attr" => ["class" => "form-control", "placeholder" => "Фамилия/Имя*"], 'data' => isset($options['data']) ? $options['data']->getRealname() : NULL])->add('username', EmailType::class, ['label' => false, "attr" => ["class" => "form-control", "placeholder" => "Email*"], 'data' => isset($options['data']) ? $options['data']->getUsername() : NULL])->add('phone', NumberType::class, ['label' => false, "attr" => ["class" => "form-control", "placeholder" => "Телефон"], 'required' => false, 'data' => isset($options['data']) ? $options['data']->getPhone() : NULL])->add('skype', TextType::class, ['label' => false, "attr" => ["class" => "form-control", "placeholder" => "Skype"], 'required' => false, 'data' => isset($options['data']) ? $options['data']->getSkype() : NULL])->add('description', TextareaType::class, ['label' => false, "attr" => ["class" => "form-control", "placeholder" => "Подробное описание", "rows" => 10], 'required' => false, 'data' => isset($options['data']) ? $options['data']->getSkype() : NULL])->add('save', SubmitType::class, ['attr' => ['class' => 'btn btn-success  center-block'], 'label' => 'Сохранить']);
     $factory = $builder->getFormFactory();
     $countrySubscriber = new AddCountryFieldSubscriber($factory);
     $builder->addEventSubscriber($countrySubscriber);
     $citySubscriber = new AddCityFieldSubscriber($factory);
     $builder->addEventSubscriber($citySubscriber);
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('contentTypeId', 'text', array('label' => 'open_orchestra_backoffice.form.content_type.content_type_id', 'attr' => array('class' => 'generate-id-dest')))->add('names', 'oo_multi_languages', array('label' => 'open_orchestra_backoffice.form.content_type.names', 'languages' => $this->backOfficeLanguages))->add('template', 'text', array('label' => 'open_orchestra_backoffice.form.content_type.template.label', 'required' => false, 'attr' => array('help_text' => 'open_orchestra_backoffice.form.content_type.template.helper')))->add('linkedToSite', 'checkbox', array('label' => 'open_orchestra_backoffice.form.content_type.linked_to_site', 'required' => false))->add('definingStatusable', 'checkbox', array('label' => 'open_orchestra_backoffice.form.content_type.defining_statusable.label', 'required' => false, 'attr' => array('help_text' => 'open_orchestra_backoffice.form.content_type.defining_statusable.helper')))->add('definingVersionable', 'checkbox', array('label' => 'open_orchestra_backoffice.form.content_type.defining_versionable.label', 'required' => false, 'attr' => array('help_text' => 'open_orchestra_backoffice.form.content_type.defining_versionable.helper')))->add('defaultListable', 'collection', array('required' => false, 'type' => 'oo_default_listable_checkbox', 'label' => 'open_orchestra_backoffice.form.content_type.default_display'))->add('fields', 'collection', array('type' => 'oo_field_type', 'allow_add' => true, 'allow_delete' => true, 'label' => 'open_orchestra_backoffice.form.content_type.fields', 'attr' => array('data-prototype-label-add' => $this->translator->trans('open_orchestra_backoffice.form.field_type.add'), 'data-prototype-label-new' => $this->translator->trans('open_orchestra_backoffice.form.field_type.new'), 'data-prototype-label-remove' => $this->translator->trans('open_orchestra_backoffice.form.field_type.delete')), 'options' => array('label' => false)));
     $builder->addEventSubscriber($this->contentTypeTypeSubscriber);
     $builder->addEventSubscriber($this->contentTypeStatusableSubscriber);
     $builder->get('fields')->addModelTransformer($this->contentTypeOrderFieldTransformer);
     if (array_key_exists('disabled', $options)) {
         $builder->setAttribute('disabled', $options['disabled']);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('name', 'text', ['label' => 'name', 'constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 3, 'max' => 255])]]);
     $builder->add('enabled', 'checkbox', ['label' => 'enabled', 'required' => false]);
     $builder->add('period', 'integer', ['label' => 'period', 'constraints' => new Assert\NotBlank()]);
     $builder->add('queue', 'choice', ['label' => 'queue', 'choices' => $this->getQueueChoices(), 'empty_value' => 'select', 'constraints' => new Assert\NotBlank()]);
     $builder->add('submit', 'submit', ['label' => 'save']);
     $builder->addEventSubscriber($this->factorySubscriber);
     $builder->addEventSubscriber($this->parametersSubscriber);
 }
Beispiel #29
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"]);
     }
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $factory = $builder->getFormFactory();
     $universitySubscriber = new AddUniversityFieldSubscriber($factory);
     $builder->addEventSubscriber($universitySubscriber);
     $collegeSubscriber = new AddCollegeFieldSubscriber($factory);
     $builder->addEventSubscriber($collegeSubscriber);
     $studentDelegationSubscriber = new AddStudentDelegationFieldSubscriber($factory);
     $builder->addEventSubscriber($studentDelegationSubscriber);
     $builder->add('firstname', null, array('label' => 'label.name'))->add('lastname', null, array('label' => 'label.last_name'))->add('email')->add('phone', null, array('label' => 'label.phone'))->add('website', null, array('label' => 'label.website'));
 }