當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。