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


PHP Form\FormConfigInterface类代码示例

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


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

示例1: assertFormConfig

 /**
  * @param array $expectedConfig
  * @param FormConfigInterface $actualConfig
  */
 protected function assertFormConfig(array $expectedConfig, FormConfigInterface $actualConfig)
 {
     foreach ($expectedConfig as $key => $value) {
         $this->assertTrue($actualConfig->hasOption($key));
         $this->assertEquals($value, $actualConfig->getOption($key));
     }
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:11,代码来源:ProductUnitPrecisionTypeTest.php

示例2:

 function it_builds_view(FormConfigInterface $config, FormView $view, FormInterface $form, FormInterface $formTable, FormInterface $formUserRegistration)
 {
     $prototypes = ['dataFetchers' => ['user_registration' => $formUserRegistration], 'renderers' => ['table' => $formTable]];
     $config->getAttribute('prototypes')->willReturn($prototypes);
     $form->getConfig()->willReturn($config);
     $formTable->createView($view)->shouldBeCalled();
     $formUserRegistration->createView($view)->shouldBeCalled();
     $this->buildView($view, $form, []);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:9,代码来源:ReportTypeSpec.php

示例3: processDateTime

 private function processDateTime(FormView $view, FormConfigInterface $config, FormRuleContextBuilder $context)
 {
     if ($config->getOption('format') !== DateTimeType::HTML5_FORMAT) {
         return;
     }
     $rules = new RuleCollection();
     $rules->set('date', new TransformerRule('date', true, $this->getFormRuleMessage($config)));
     $context->add($view, $rules);
 }
开发者ID:robertfausk,项目名称:JqueryValidationBundle,代码行数:9,代码来源:DateTimeToStringTransformerPass.php

示例4: getFormRuleMessage

 protected function getFormRuleMessage(FormConfigInterface $config)
 {
     // Get correct error message if one is set.
     if ($config->hasOption('invalid_message')) {
         $params = $config->getOption('invalid_message_parameters');
         return new RuleMessage($config->getOption('invalid_message'), is_array($params) ? $params : array());
     }
     return null;
 }
开发者ID:robertfausk,项目名称:JqueryValidationBundle,代码行数:9,代码来源:ViewTransformerProcessor.php

示例5: __construct

 public function __construct(FormConfigInterface $config)
 {
     if ($config->getCompound() && !$config->getDataMapper()) {
         throw new LogicException('Compound forms need a data mapper');
     }
     if ($config->getInheritData()) {
         $this->defaultDataSet = true;
     }
     $this->config = $config;
     $this->children = new OrderedHashMap();
 }
开发者ID:lovenunu,项目名称:miniphpy,代码行数:11,代码来源:sf2_form.min.php

示例6: configure

 /**
  * {@inheritdoc}
  */
 public function configure($name, array $options, array $metadata, FormConfigInterface $parentConfig)
 {
     // The implementation uses a FormTypeGuesserInterface instance in order
     // to guess the "required" value from different sources (PHPdoc,
     // validation or doctrine metadata, etc.)
     $guessed = $this->guesser->guessRequired($parentConfig->getDataClass(), $name);
     if (null !== $guessed) {
         $options['required'] = $guessed->getValue();
     }
     return $options;
 }
开发者ID:sebastianlp,项目名称:EasyAdminBundle,代码行数:14,代码来源:RequiredOptionConfigurator.php

示例7: prepareOptions

 /**
  * Prepare form options from config
  *
  * @param FormConfigInterface $config
  *
  * @return $config
  */
 protected function prepareOptions(FormConfigInterface $config)
 {
     $options = array('disabled' => true, 'read_only' => true);
     if ($help = $config->getOption('help')) {
         $options['help'] = $help;
     }
     if ($label = $config->getOption('label')) {
         $options['label'] = $label;
     }
     if ($select2 = $config->getOption('select2')) {
         $options['select2'] = $select2;
     }
     return $options;
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:21,代码来源:DisableFieldSubscriber.php

示例8: configure

 /**
  * {@inheritdoc}
  */
 public function configure($name, array $options, array $metadata, FormConfigInterface $parentConfig)
 {
     if (!isset($options['class'])) {
         $guessedOptions = $this->guesser->guessType($parentConfig->getDataClass(), $name)->getOptions();
         $options['class'] = $guessedOptions['class'];
         $options['multiple'] = $guessedOptions['multiple'];
         $options['em'] = $guessedOptions['em'];
     }
     if ($metadata['associationType'] & ClassMetadata::TO_MANY) {
         $options['attr']['multiple'] = true;
     }
     // Supported associations are displayed using advanced JavaScript widgets
     $options['attr']['data-widget'] = 'select2';
     // Configure "placeholder" option for entity fields
     if ($metadata['associationType'] & ClassMetadata::TO_ONE && !isset($options[$placeHolderOptionName = $this->getPlaceholderOptionName()]) && false === $options['required']) {
         $options[$placeHolderOptionName] = 'form.label.empty_value';
     }
     return $options;
 }
开发者ID:sebastianlp,项目名称:EasyAdminBundle,代码行数:22,代码来源:EntityTypeConfigurator.php

示例9: getFilterTypeName

 /**
  * Get filter type name by form config
  *
  * @param FormConfigInterface $config
  *
  * @return string
  *
  * @deprecated Deprecated since version 2.0, to be removed in 2.1. Use EventDispatcher instead.
  */
 protected function getFilterTypeName(FormConfigInterface $config)
 {
     $formType = $config->getType()->getInnerType();
     return $config->hasAttribute('apply_filter') && is_string($config->getAttribute('apply_filter')) ? $config->getAttribute('apply_filter') : $formType->getName();
 }
开发者ID:justus-alex,项目名称:TaxiPrize,代码行数:14,代码来源:FilterBuilderUpdater.php

示例10: getFormRuleMessage

 protected function getFormRuleMessage(FormConfigInterface $config)
 {
     // Get correct error message if one is set.
     if ($config->hasOption('invalid_message')) {
         // TODO support invalid_message_parameters
         return new RuleMessage($config->getOption('invalid_message'));
     }
     return null;
 }
开发者ID:robertfausk,项目名称:JqueryValidationBundle,代码行数:9,代码来源:CompoundCopyToChildPass.php

示例11: validateChoiceLoaderForDefaultOptions

 protected function validateChoiceLoaderForDefaultOptions(FormConfigInterface $config)
 {
     $this->assertNull($config->getOption('choice_loader'));
 }
开发者ID:mcdir,项目名称:SonatraFormExtensionsBundle,代码行数:4,代码来源:AbstractSelect2TypeExtensionTest.php

示例12: __construct

 /**
  * Creates an unmodifiable copy of a given configuration.
  *
  * @param  FormConfigInterface $config The configuration to copy.
  */
 public function __construct(FormConfigInterface $config)
 {
     $dispatcher = $config->getEventDispatcher();
     if (!$dispatcher instanceof UnmodifiableEventDispatcher) {
         $dispatcher = new UnmodifiableEventDispatcher($dispatcher);
     }
     $this->dispatcher = $dispatcher;
     $this->name = $config->getName();
     $this->propertyPath = $config->getPropertyPath();
     $this->mapped = $config->getMapped();
     $this->byReference = $config->getByReference();
     $this->virtual = $config->getVirtual();
     $this->compound = $config->getCompound();
     $this->types = $config->getTypes();
     $this->viewTransformers = $config->getViewTransformers();
     $this->modelTransformers = $config->getModelTransformers();
     $this->dataMapper = $config->getDataMapper();
     $this->validators = $config->getValidators();
     $this->required = $config->getRequired();
     $this->disabled = $config->getDisabled();
     $this->errorBubbling = $config->getErrorBubbling();
     $this->emptyData = $config->getEmptyData();
     $this->attributes = $config->getAttributes();
     $this->data = $config->getData();
     $this->dataClass = $config->getDataClass();
     $this->options = $config->getOptions();
 }
开发者ID:navassouza,项目名称:symfony,代码行数:32,代码来源:UnmodifiableFormConfig.php

示例13: validateChoiceLoaderForDefaultOptions

 protected function validateChoiceLoaderForDefaultOptions(FormConfigInterface $config)
 {
     $this->assertInstanceOf('Symfony\\Bridge\\Doctrine\\Form\\ChoiceList\\DoctrineChoiceLoader', $config->getOption('choice_loader'));
 }
开发者ID:mcdir,项目名称:SonatraFormExtensionsBundle,代码行数:4,代码来源:EntitySelect2TypeExtensionTest.php

示例14: assignFormTypeValues

 /**
  * @param \Smarty_Internal_Template $template
  * @param FormConfigInterface       $formFieldConfig
  * @param FormView                  $formFieldView
  */
 protected function assignFormTypeValues($template, $formFieldConfig, $formFieldView)
 {
     $formFieldType = $formFieldConfig->getType()->getInnerType();
     /* access to choices */
     if ($formFieldType instanceof ChoiceType) {
         $template->assign("choices", $formFieldView->vars['choices']);
     }
     /* access to collections */
     if ($formFieldType instanceof CollectionType) {
         if (true === $formFieldConfig->getOption('prototype')) {
         } else {
             /* access to choices */
             if (isset($formFieldView->vars['choices'])) {
                 $template->assign("choices", $formFieldView->vars['choices']);
             }
         }
     }
     /* access to thelia type */
     if ($formFieldType instanceof TheliaType) {
         $template->assign("formType", $formFieldView->vars['type']);
         switch ($formFieldView->vars['type']) {
             case "choice":
                 if (!isset($formFieldView->vars['options']['choices']) || !is_array($formFieldView->vars['options']['choices'])) {
                     //throw new
                 }
                 $choices = array();
                 foreach ($formFieldView->vars['options']['choices'] as $value => $choice) {
                     $choices[] = new ChoiceView($value, $value, $choice);
                 }
                 $template->assign("choices", $choices);
                 break;
         }
     }
 }
开发者ID:alex63530,项目名称:thelia,代码行数:39,代码来源:Form.php

示例15: assignFormTypeValues

 /**
  * @param \Smarty_Internal_Template $template
  * @param FormConfigInterface       $formFieldConfig
  * @param FormView                  $formFieldView
  */
 protected function assignFormTypeValues($template, $formFieldConfig, $formFieldView)
 {
     $formFieldType = $formFieldConfig->getType()->getInnerType();
     /* access to choices */
     if ($formFieldType instanceof ChoiceType) {
         $template->assign("choices", $formFieldView->vars['choices']);
     }
     /* access to collections */
     if ($formFieldType instanceof CollectionType) {
         if (true === $formFieldConfig->getOption('prototype')) {
         } else {
             /* access to choices */
             if (isset($formFieldView->vars['choices'])) {
                 $template->assign("choices", $formFieldView->vars['choices']);
             }
         }
     }
     /* access to date */
     if ($formFieldType instanceof DateType || $formFieldType instanceof DateTimeType || $formFieldType instanceof BirthdayType) {
         if ('choice' === $formFieldConfig->getOption('widget')) {
             /* access to years */
             if ($formFieldConfig->getOption('years')) {
                 $formFieldView->vars['years'] = $formFieldConfig->getOption('years');
                 $template->assign("years", $formFieldView->vars['years']);
             }
             /* access to month */
             if ($formFieldConfig->getOption('months')) {
                 $formFieldView->vars['months'] = $formFieldConfig->getOption('months');
                 $template->assign("months", $formFieldView->vars['months']);
             }
             /* access to days */
             if ($formFieldConfig->getOption('days')) {
                 $formFieldView->vars['days'] = $formFieldConfig->getOption('days');
                 $template->assign("days", $formFieldView->vars['days']);
             }
             /* access to empty_value */
             if ($formFieldConfig->getOption('empty_value')) {
                 $formFieldView->vars['empty_value'] = $formFieldConfig->getOption('empty_value');
                 $template->assign("empty_value", $formFieldView->vars['empty_value']);
             }
         }
     }
     /* access to thelia type */
     if ($formFieldType instanceof TheliaType) {
         $template->assign("formType", $formFieldView->vars['type']);
         switch ($formFieldView->vars['type']) {
             case "choice":
                 if (!isset($formFieldView->vars['options']['choices']) || !is_array($formFieldView->vars['options']['choices'])) {
                     //throw new
                 }
                 $choices = array();
                 foreach ($formFieldView->vars['options']['choices'] as $value => $choice) {
                     $choices[] = new ChoiceView($value, $value, $choice);
                 }
                 $template->assign("choices", $choices);
                 break;
         }
     }
 }
开发者ID:jantotof,项目名称:thelia,代码行数:64,代码来源:Form.php


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