本文整理汇总了PHP中Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration::getFormOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestConfiguration::getFormOptions方法的具体用法?PHP RequestConfiguration::getFormOptions怎么用?PHP RequestConfiguration::getFormOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration
的用法示例。
在下文中一共展示了RequestConfiguration::getFormOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_creates_the_object_if_form_is_a_class_name(RequestConfiguration $requestConfiguration, ResourceInterface $resource, FormFactoryInterface $formFactory, FormInterface $form)
{
$requestConfiguration->isHtmlRequest()->willReturn(true);
$requestConfiguration->getFormType()->willReturn(TextType::class);
$requestConfiguration->getFormOptions()->willReturn([]);
$formFactory->create(Argument::type(TextType::class), $resource, Argument::type('array'))->willReturn($form);
$this->create($requestConfiguration, $resource)->shouldReturn($form);
}
示例2:
function it_creates_form_without_root_name_and_disables_csrf_protection_for_non_html_requests(RequestConfiguration $requestConfiguration, ResourceInterface $resource, FormFactoryInterface $formFactory, FormInterface $form)
{
$requestConfiguration->isHtmlRequest()->willReturn(false);
$requestConfiguration->getFormType()->willReturn('sylius_product_api');
$requestConfiguration->getFormOptions()->willReturn([]);
$formFactory->createNamed('', 'sylius_product_api', $resource, ['csrf_protection' => false])->willReturn($form);
$this->create($requestConfiguration, $resource)->shouldReturn($form);
}
示例3: create
/**
* {@inheritdoc}
*/
public function create(RequestConfiguration $requestConfiguration, ResourceInterface $resource)
{
$formType = $requestConfiguration->getFormType();
$formOptions = $requestConfiguration->getFormOptions();
if ($requestConfiguration->isHtmlRequest()) {
return $this->formFactory->create($formType, $resource, $formOptions);
}
return $this->formFactory->createNamed('', $formType, $resource, array_merge($formOptions, ['csrf_protection' => false]));
}