本文整理匯總了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]));
}