class BaseForm

Base form class for creating form objects

Class BaseForm

Methods

__construct( Request $request, string $type = 'form', array $data = array(), array $options = array(), ContainerInterface $container = null)

No description

initFormWithContainer($type, $data, $options)

No description

FormBuilderInterface
getFormBuilder()

No description

string
getType()

No description

bool
isTemplateDefinedHiddenField( FormView $fieldView)

Return true if the given field value is defined only in the HTML template, and its value is defined in the template file, not the form builder.

isTemplateDefinedHiddenFieldName($fieldName)

No description

getRequest()

No description

string
getErrorUrl( string $default = null)

Returns the absolute URL to redirect the user to if the form is not successfully processed, using the 'error_url' form parameter value

bool
hasErrorUrl()

No description

string
getSuccessUrl( string $default = null)

Returns the absolute URL to redirect the user to if the form is successfully processed.

bool
hasSuccessUrl()

No description

string
getFormDefinedUrl( string $parameterName, string $default = null)

Build an absolute URL using the value of a form parameter.

createView()

No description

FormView
getView()

No description

$this
setError( boolean $has_error = true)

Set the error status of the form.

boolean
hasError()

Get the cuirrent error status of the form.

$this
setErrorMessage( string $message)

Set the error message related to global form error

string
getErrorMessage()

Get the form error message.

Form
getForm()

No description

bool
hasContainer()

No description

string
getName()

Override this method if you don't want to use the standard name, which is created from the full class name.

Details

at line 115
__construct( Request $request, string $type = 'form', array $data = array(), array $options = array(), ContainerInterface $container = null)

Parameters

Request $request
string $type
array $data
array $options
ContainerInterface $container

See also

BaseController::createForm()

at line 213
initFormWithContainer($type, $data, $options)

Parameters

$type
$data
$options

at line 243
FormBuilderInterface getFormBuilder()

Return Value

FormBuilderInterface

at line 251
string getType()

Return Value

string

at line 265
bool isTemplateDefinedHiddenField( FormView $fieldView)

Return true if the given field value is defined only in the HTML template, and its value is defined in the template file, not the form builder.

Thus, it should not be included in the form hidden fields generated by formhiddenfields Smarty function, to prevent it from existing twice in the form.

Parameters

FormView $fieldView

Return Value

bool

at line 270
isTemplateDefinedHiddenFieldName($fieldName)

Parameters

$fieldName

at line 278
Request getRequest()

Return Value

Request

at line 297
string getErrorUrl( string $default = null)

Returns the absolute URL to redirect the user to if the form is not successfully processed, using the 'error_url' form parameter value

Parameters

string $default the default URL. If not given, the configured base URL is used.

Return Value

string an absolute URL

at line 305
bool hasErrorUrl()

Return Value

bool true if an error URL is defined in the 'error_url' form parameter, false otherwise

at line 317
string getSuccessUrl( string $default = null)

Returns the absolute URL to redirect the user to if the form is successfully processed.

using the 'success_url' form parameter value

Parameters

string $default the default URL. If not given, the configured base URL is used.

Return Value

string an absolute URL

at line 325
bool hasSuccessUrl()

Return Value

bool true if a success URL is defined in the form, false otherwise

at line 337
string getFormDefinedUrl( string $parameterName, string $default = null)

Build an absolute URL using the value of a form parameter.

Parameters

string $parameterName the form parameter name
string $default a default value for the form parameter. If not defined, the configured base URL is used.

Return Value

string an absolute URL

at line 352
createView()

at line 363
FormView getView()

Return Value

FormView

Exceptions

LogicException

at line 380
$this setError( boolean $has_error = true)

Set the error status of the form.

Parameters

boolean $has_error

Return Value

$this

at line 392
boolean hasError()

Get the cuirrent error status of the form.

Return Value

boolean

at line 403
$this setErrorMessage( string $message)

Set the error message related to global form error

Parameters

string $message

Return Value

$this

at line 416
string getErrorMessage()

Get the form error message.

Return Value

string

at line 424
Form getForm()

Return Value

Form

at line 432
bool hasContainer()

Return Value

bool

at line 442
string getName()

Override this method if you don't want to use the standard name, which is created from the full class name.

Return Value

string the name of you form. This name must be unique