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


PHP FormConfigInterface::getOption方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: validateChoiceLoaderForDefaultOptions

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

示例6: validateChoiceLoaderForDefaultOptions

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

示例7: 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

示例8: 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

示例9: 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


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