本文整理汇总了PHP中Symfony\Component\Form\FormBuilderInterface::setAction方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilderInterface::setAction方法的具体用法?PHP FormBuilderInterface::setAction怎么用?PHP FormBuilderInterface::setAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\FormBuilderInterface
的用法示例。
在下文中一共展示了FormBuilderInterface::setAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/** ************************************************************************
* @param FormBuilderInterface $builder
* @param array $options
**************************************************************************/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('accountId', 'hidden', array('mapped' => false))->add('htmlString', 'hidden', array('mapped' => false))->add('operationList', 'collection', array('type' => new OperationType(), 'mapped' => false, 'label' => NULL, 'allow_add' => true, 'allow_delete' => true))->add('transferBetweenAccountList', 'collection', array('type' => new TransferBetweenAccountType(), 'mapped' => false, 'label' => NULL, 'allow_add' => true, 'allow_delete' => true));
if ($this->account !== NULL) {
$builder->setAction($this->router->generate('finance_operation_operation_persistimportform', array('account_id' => $this->account->getId())));
}
}
示例2: 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"]);
}
}
示例3: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', 'textarea', array('label' => 'ddi.lead_actions.tasks.thead.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'nomousetrap form-control', 'rows' => 10), 'constraints' => array(new NotBlank(array('message' => 'ddi.lead_actions.task.name.notblank')))));
// Campaign builder form
if (!empty($options['type'])) {
$data = empty($options['data']['dateInterval']) ? 1 : $options['data']['dateInterval'];
$builder->add('dateInterval', 'number', array('label' => 'ddi.lead_actions.tasks.form.due_date_after', 'attr' => array('class' => 'form-control', 'preaddon' => 'symbol-hashtag'), 'data' => $data));
$data = !empty($options['data']['dateIntervalUnit']) ? $options['data']['dateIntervalUnit'] : 'd';
$builder->add('dateIntervalUnit', 'choice', array('choices' => array('i' => 'mautic.campaign.event.intervalunit.choice.i', 'h' => 'mautic.campaign.event.intervalunit.choice.h', 'd' => 'mautic.campaign.event.intervalunit.choice.d', 'm' => 'mautic.campaign.event.intervalunit.choice.m', 'y' => 'mautic.campaign.event.intervalunit.choice.y'), 'multiple' => false, 'label_attr' => array('class' => 'control-label'), 'label' => false, 'attr' => array('class' => 'form-control'), 'empty_value' => false, 'required' => false, 'data' => $data));
// Default form
} else {
$dueDate = $builder->create('dueDate', 'datetime', array('widget' => 'single_text', 'label' => 'ddi.lead_actions.tasks.thead.due_date', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'nomousetrap form-control', 'data-toggle' => 'datetime', 'preaddon' => 'fa fa-calendar'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => true, 'constraints' => array(new NotBlank(array('message' => 'ddi.lead_actions.task.due_date.notblank')))));
$builder->add($dueDate);
$builder->add('buttons', 'form_buttons', array('apply_text' => false, 'save_text' => 'mautic.core.form.save'));
}
$assignUser = $builder->create('assignUser', 'user_list', array('label' => 'ddi.lead_actions.tasks.thead.assigned_user', 'label_attr' => array('class' => 'control-label, required'), 'attr' => array('class' => 'nomousetrap form-control'), 'required' => false, 'multiple' => false, 'constraints' => array(new NotBlank(array('message' => 'ddi.lead_actions.task.assigned_user.notblank')))));
if (empty($options['type'])) {
$transformer = new IdToEntityModelTransformer($this->factory->getEntityManager(), 'MauticUserBundle:User');
$assignUser->addModelTransformer($transformer);
}
$builder->add($assignUser);
if (!empty($options['action'])) {
$builder->setAction($options['action']);
}
}
示例4: 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']);
}
}
示例5: buildForm
/**
* @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();']]]]);
}
示例6: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('isPublished', 'yesno_button_group');
$keys = $options['integration_object']->getRequiredKeyFields();
$decryptedKeys = $options['integration_object']->decryptApiKeys($options['data']->getApiKeys());
$builder->add('apiKeys', 'integration_keys', array('label' => false, 'integration_keys' => $keys, 'data' => $decryptedKeys, 'integration_object' => $options['integration_object']));
$formSettings = $options['integration_object']->getFormSettings();
if (!empty($formSettings['requires_authorization'])) {
$disabled = false;
$label = $options['integration_object']->isAuthorized() ? 'reauthorize' : 'authorize';
$builder->add('authButton', 'standalone_button', array('attr' => array('class' => 'btn btn-primary', 'onclick' => 'Mautic.initiateIntegrationAuthorization()', 'icon' => 'fa fa-key'), 'label' => 'mautic.integration.form.' . $label, 'disabled' => $disabled));
}
$features = $options['integration_object']->getSupportedFeatures();
if (!empty($features)) {
// Check to see if the integration is a new entry and thus not configured
$configured = $options['data']->getId() !== null;
$enabledFeatures = $options['data']->getSupportedFeatures();
$data = $configured ? $enabledFeatures : $features;
$labels = array();
foreach ($features as $f) {
$labels[] = 'mautic.integration.form.feature.' . $f;
}
$builder->add('supportedFeatures', 'choice', array('choice_list' => new ChoiceList($features, $labels), 'expanded' => true, 'label_attr' => array('class' => 'control-label'), 'multiple' => true, 'label' => 'mautic.integration.form.features', 'required' => false, 'data' => $data));
$builder->add('featureSettings', 'integration_featuresettings', array('label' => 'mautic.integration.form.feature.settings', 'required' => true, 'data' => $options['data']->getFeatureSettings(), 'label_attr' => array('class' => 'control-label'), 'integration' => $options['integration'], 'integration_object' => $options['integration_object'], 'lead_fields' => $options['lead_fields']));
}
$builder->add('name', 'hidden', array('data' => $options['integration']));
$builder->add('in_auth', 'hidden', array('mapped' => false));
$builder->add('buttons', 'form_buttons', array('apply_text' => false, 'save_text' => 'mautic.core.form.save'));
if (!empty($options['action'])) {
$builder->setAction($options['action']);
}
}
示例7: 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"]);
}
}
示例8: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('quote', TextareaType::class)->add('author', TextType::class, array('attr' => array('class' => 'typeahead')));
if (!empty($options['action'])) {
$builder->setAction($options['action']);
}
}
示例9: 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('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"]);
}
}
示例10: buildForm
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
// ajout de action si défini
if (isset($this->parametres['form_action'])) {
$builder->setAction($this->parametres['form_action']);
}
// Builder…
$factory = $builder->getFormFactory();
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($factory) {
$data = $event->getData();
// important : GARDER CETTE CONDITION CI-DESSOUS (toujours !!!)
if (null === $data) {
return;
}
if (null === $data->getId()) {
// création
$event->getForm()->add('nom', 'textarea', array('label' => 'form.nom', 'required' => true, 'attr' => array('rows' => 6, 'style' => 'resize: vertical;')));
} else {
// L'entité existe : édition
$event->getForm()->add('nom', 'text', array('label' => 'form.nom', 'required' => true));
}
});
// ajoute les valeurs hidden, passés en paramètre
$builder = $this->addHiddenValues($builder);
// AJOUT SUBMIT
$builder->add('submit', 'submit', array('label' => 'form.enregistrer', 'attr' => array('class' => "btn btn-md btn-block btn-info")));
}
示例11: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$masks = ['description' => 'html'];
$builder->add('name', 'text', ['label' => 'mautic.core.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
$builder->add('description', 'textarea', ['label' => 'mautic.core.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control editor'], 'required' => false]);
if (!empty($options['settings']['formType'])) {
$properties = !empty($options['data']['properties']) ? $options['data']['properties'] : null;
$formTypeOptions = ['label' => false, 'data' => $properties];
if (!empty($options['settings']['formTypeOptions'])) {
$formTypeOptions = array_merge($formTypeOptions, $options['settings']['formTypeOptions']);
}
if (isset($options['settings']['formTypeCleanMasks'])) {
$masks['properties'] = $options['settings']['formTypeCleanMasks'];
}
$builder->add('properties', $options['settings']['formType'], $formTypeOptions);
}
$builder->add('type', 'hidden');
$update = !empty($properties);
if (!empty($update)) {
$btnValue = 'mautic.core.form.update';
$btnIcon = 'fa fa-pencil';
} else {
$btnValue = 'mautic.core.form.add';
$btnIcon = 'fa fa-plus';
}
$builder->add('buttons', 'form_buttons', ['save_text' => $btnValue, 'save_icon' => $btnIcon, 'apply_text' => false, 'container_class' => 'bottom-form-buttons']);
$builder->add('triggerId', 'hidden', ['mapped' => false]);
$builder->addEventSubscriber(new CleanFormSubscriber($masks));
if (!empty($options['action'])) {
$builder->setAction($options['action']);
}
}
示例12: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('cancel', 'button', array('label' => 'Cancel', 'attr' => array('class' => 'overlay-close cancel')))->add('save', 'submit', array('label' => ' ', 'attr' => array('class' => 'save pe-7s-check')));
if ($options['action'] != '') {
$builder->setAction($options['action']);
}
}
示例13: buildForm
/**
* {@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']);
}
}
示例14: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setAction($this->urlGenerator->generate($options['route'], $options['route_parameters']));
$builder->setMethod('POST');
$builder->add('locale', 'choice', ['label' => false, 'required' => true, 'widget_addon_prepend' => ['icon' => 'language'], 'choices' => $this->localeChoiceList->create(), 'choices_as_values' => true]);
$builder->add('switch', 'submit', ['label' => 'stepup_middleware_client.form.switch_locale.switch', 'attr' => ['class' => 'btn btn-default']]);
}
示例15: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setAction($options['data']['url'])->setMethod('GET')->add('roles', 'choice', array('choices' => array('user.role.corporation_travel_manager' => 'ROLE_CORPORATION_TRAVEL_MANAGER', 'user.role.agency_tc_only' => 'ROLE_TC_ONLY', 'user.role.agency_waiver_request_only' => 'ROLE_WAIVER_REQUEST_ONLY', 'user.role.agency_core_user' => 'ROLE_AGENCY_CORE_USER', 'user.role.agency_management_user' => 'ROLE_AGENCY_MANAGEMENT_USER', 'user.role.agency_signee' => 'ROLE_AGENCY_SIGNEE', 'user.role.sales_support_user' => 'ROLE_SALES_SUPPORT_USER', 'user.role.sales_support_supervisor' => 'ROLE_SALES_SUPPORT_SUPERVISOR', 'user.role.audit_dispute_user' => 'ROLE_AUDIT_DISPUTE_USER', 'user.role.audit_dispute_supervisor' => 'ROLE_AUDIT_DISPUTE_SUPERVISOR', 'user.role.audit_user' => 'ROLE_AUDIT_USER', 'user.role.sales_am' => 'ROLE_SALES_AM', 'user.role.sales_gg' => 'ROLE_SALES_GG', 'user.role.sales_oal_user' => 'ROLE_SALES_OAL_USER', 'user.role.sales_oal_supervisor' => 'ROLE_SALES_OAL_USER_SUPERVISOR', 'user.role.pricing_oal_user' => 'ROLE_PRICING_OAL_USER', 'user.role.pricing_oal_supervisor' => 'ROLE_PRICING_OAL_USER_SUPERVISOR', 'user.role.pricing_lhg_user' => 'ROLE_PRICING_LHG_USER', 'user.role.accounting' => 'ROLE_ACCOUNTING', 'user.role.contract_admin' => 'ROLE_CONTRACT_ADMIN', 'user.role.spc' => 'ROLE_SPC', 'user.role.app_admin' => 'ROLE_APP_ADMIN'), 'choices_as_values' => true, 'label' => 'Roles', 'expanded' => true, 'multiple' => true, 'translation_domain' => 'UserBundle'))->add('enabled', 'choice', array('choices' => array('user.status.enabled' => 1, 'user.status.disabled' => 0), 'choices_as_values' => true, 'label' => 'Enabled', 'expanded' => true, 'multiple' => true, 'translation_domain' => 'UserBundle'));
$user = $this->tokenStorage->getToken()->getUser();
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($user) {
$form = $event->getForm();
// only show specific filters based on user's context
// $form->add('airlines', 'entity', array(
// 'class' => 'AppBundle:Airline', 'property' => 'id',
// 'query_builder' => function (EntityRepository $er) use ($user) {
// $airlines = $user->getAirlines();
//
// return $er->createQueryBuilder('a')
// ->addOrderBy('a.id', 'ASC')
// ->andWhere('a.id IN (?1)')
// ->setParameter(1,$airlines);
// },
// 'choice_value' => 'id',
// 'choice_label' => 'id', 'label' => 'Airlines',
// 'expanded' => true, 'multiple' => true,));
$form->add('markets', 'entity', array('class' => 'AppBundle:Market', 'property' => 'id', 'query_builder' => function (EntityRepository $er) use($user) {
$markets = $user->getMarkets();
return $er->createQueryBuilder('m')->addOrderBy('m.id', 'ASC')->andWhere('m.id IN (?1)')->setParameter(1, $markets);
}, 'choice_value' => 'id', 'choice_label' => 'id', 'label' => 'Markets', 'expanded' => true, 'multiple' => true));
});
}