mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 13:03:20 +00:00
Add method to Api Form Factory factories
This commit is contained in:
@@ -56,32 +56,36 @@ abstract class BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $formType
|
* @param string $method
|
||||||
* @param mixed $data
|
* @param mixed $formType
|
||||||
|
* @param array $options
|
||||||
|
* @param mixed $data
|
||||||
* @return FormInterface
|
* @return FormInterface
|
||||||
*/
|
*/
|
||||||
public function createApiForm($formType, $data, array $options = [])
|
public function createApiForm($method = 'POST', $formType = 'form', array $options = [], $data = null)
|
||||||
{
|
{
|
||||||
return $this->app['form.factory']->createNamed(
|
return $this->app['form.factory']->createNamed(
|
||||||
'data',
|
'data',
|
||||||
$formType,
|
$formType,
|
||||||
$data,
|
$data,
|
||||||
array_merge(['csrf_protection' => false], $options)
|
array_merge(['method' => $method, 'csrf_protection' => false], $options)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $formType
|
* @param string $method
|
||||||
* @param mixed $data
|
* @param mixed $formType
|
||||||
|
* @param array $options
|
||||||
|
* @param mixed $data
|
||||||
* @return FormBuilderInterface
|
* @return FormBuilderInterface
|
||||||
*/
|
*/
|
||||||
public function createApiFormBuilder($formType = 'form', $data = null, array $options = [])
|
public function createApiFormBuilder($method = 'POST', $formType = 'form', array $options = [], $data = null)
|
||||||
{
|
{
|
||||||
return $this->app['form.factory']->createNamedBuilder(
|
return $this->app['form.factory']->createNamedBuilder(
|
||||||
'data',
|
'data',
|
||||||
$formType,
|
$formType,
|
||||||
$data,
|
$data,
|
||||||
array_merge(['csrf_protection' => false], $options)
|
array_merge(['method' => $method, 'csrf_protection' => false], $options)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user