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


PHP FormBuilder::getOption方法代码示例

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


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

示例1: array

 function it_builds_attribute_types_prototype_and_passes_it_as_argument(FormBuilder $builder, FormBuilder $fieldBuilder, FormFactoryInterface $formFactory, ChoiceListInterface $choiceList, AttributeInterface $attribute)
 {
     $builder->getFormFactory()->willReturn($formFactory);
     $builder->add('attribute', 'sylius_server_attribute_choice', Argument::any())->willReturn($builder);
     $builder->addEventSubscriber(Argument::any())->willReturn($builder);
     $attribute->getType()->willReturn('checkbox')->shouldBeCalled();
     $attribute->getConfiguration()->willReturn(array('label' => 'sylius.form.attribute.server_attribute_value.value'))->shouldBeCalled();
     $choiceList->getChoices()->willReturn(array($attribute));
     $fieldBuilder->getOption('choice_list')->willReturn($choiceList);
     $builder->get('attribute')->willReturn($fieldBuilder);
     $builder->create('value', 'checkbox', array('label' => 'sylius.form.attribute.server_attribute_value.value'))->shouldBeCalled()->willReturn($fieldBuilder);
     $fieldBuilder->getForm()->willReturn('Form for attribute');
     $builder->setAttribute('prototypes', array(0 => 'Form for attribute'))->shouldBeCalled();
     $this->buildForm($builder, array());
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:15,代码来源:AttributeValueTypeSpec.php

示例2: buildMediaType

 /**
  * {@inheritdoc}
  */
 public function buildMediaType(FormBuilder $formBuilder)
 {
     $formBuilder->add('binaryContent', 'file');
     if ($formBuilder->getOption('context') == 'api') {
         $formBuilder->add('contentType');
     }
 }
开发者ID:kea,项目名称:SonataMediaBundle,代码行数:10,代码来源:FileProvider.php

示例3: buildMediaType

 /**
  * {@inheritdoc}
  */
 public function buildMediaType(FormBuilder $formBuilder)
 {
     if ($formBuilder->getOption('context') == 'api') {
         $formBuilder->add('binaryContent', 'file');
         $formBuilder->add('contentType');
     } else {
         $formBuilder->add('binaryContent', 'file', array('required' => false, 'label' => 'widget_label_binary_content'));
     }
 }
开发者ID:elvetemedve,项目名称:SonataMediaBundle,代码行数:12,代码来源:FileProvider.php

示例4: buildMediaType

 /**
  * @param FormBuilder $formBuilder
  */
 public function buildMediaType(FormBuilder $formBuilder)
 {
     if ($formBuilder->getOption('context') !== 'api') {
         $formBuilder->add('binaryContent', FileType::class, array('required' => true, 'label' => false));
     }
 }
开发者ID:dreamlex,项目名称:ticketbundle,代码行数:9,代码来源:TicketImageProvider.php

示例5: buildResetAction

 /**
  * @param FormBuilder $builder
  *
  * @throws \Exception
  */
 protected function buildResetAction(FormBuilder $builder)
 {
     $action = $builder->getOption('action');
     $defaults = ['form_type' => LinkType::class, 'label' => 'sidus.datagrid.reset.label', 'uri' => $action ?: '?', 'icon' => 'close'];
     $options = array_merge($defaults, $this->getResetButton());
     $type = $options['form_type'];
     unset($options['form_type']);
     $builder->add('filterResetButton', $type, $options);
 }
开发者ID:VincentChalnot,项目名称:SidusDataGridBundle,代码行数:14,代码来源:DataGrid.php

示例6: getValue

 /**
  * Get type value from resource.
  *
  * @param $objectOrArray
  * @param $propertyPath
  * @param FormBuilder $formConfig
  *
  * @return array|string
  */
 public function getValue($objectOrArray, $propertyPath, FormBuilder $formConfig)
 {
     if (!is_a($objectOrArray, 'EasyRdf\\Resource')) {
         return $objectOrArray;
     }
     if (is_string($propertyPath)) {
         $propertyPath = new PropertyPath($propertyPath);
     } elseif (!$propertyPath instanceof PropertyPathInterface) {
         throw new UnexpectedTypeException($propertyPath, 'string or Symfony\\Component\\PropertyAccess\\PropertyPathInterface');
     }
     $property = (string) $propertyPath;
     $resources = null;
     if ($formConfig->getOption('multiple')) {
         $resources = $objectOrArray->all($property);
     } elseif ($formConfig->getType()->getName() === 'collection') {
         $resources = $objectOrArray->all($property);
     } else {
         $resources = $objectOrArray->get($property);
     }
     return $this->getLiteralValues($resources);
 }
开发者ID:conjecto,项目名称:nemrod,代码行数:30,代码来源:ResourcePropertyPathMapper.php


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