Drupal 8  8.0.2
FormStateInterface Interface Reference
Inheritance diagram for FormStateInterface:

Public Member Functions

getCompleteForm ()
 
 setCompleteForm (array &$complete_form)
 
 loadInclude ($module, $type, $name=NULL)
 
 getCacheableArray ()
 
 setFormState (array $form_state_additions)
 
 setResponse (Response $response)
 
 getResponse ()
 
 setRedirect ($route_name, array $route_parameters=array(), array $options=array())
 
 setRedirectUrl (Url $url)
 
 getRedirect ()
 
 setStorage (array $storage)
 
getStorage ()
 
get ($property)
 
 set ($property, $value)
 
 has ($property)
 
 setBuildInfo (array $build_info)
 
 getBuildInfo ()
 
 addBuildInfo ($property, $value)
 
getUserInput ()
 
 setUserInput (array $user_input)
 
getValues ()
 
getValue ($key, $default=NULL)
 
 setValues (array $values)
 
 setValue ($key, $value)
 
 unsetValue ($key)
 
 hasValue ($key)
 
 isValueEmpty ($key)
 
 setValueForElement (array $element, $value)
 
 setErrorByName ($name, $message= '')
 
 setError (array &$element, $message= '')
 
 clearErrors ()
 
 getErrors ()
 
 getError (array $element)
 
 setRebuild ($rebuild=TRUE)
 
 isRebuilding ()
 
 setInvalidToken ($invalid_token)
 
 hasInvalidToken ()
 
 prepareCallback ($callback)
 
 getFormObject ()
 
 setFormObject (FormInterface $form_object)
 
 setAlwaysProcess ($always_process=TRUE)
 
 getAlwaysProcess ()
 
 setButtons (array $buttons)
 
 getButtons ()
 
 setCached ($cache=TRUE)
 
 isCached ()
 
 disableCache ()
 
 setExecuted ()
 
 isExecuted ()
 
 setGroups (array $groups)
 
getGroups ()
 
 setHasFileElement ($has_file_element=TRUE)
 
 hasFileElement ()
 
 setLimitValidationErrors ($limit_validation_errors)
 
 getLimitValidationErrors ()
 
 setMethod ($method)
 
 setRequestMethod ($method)
 
 isMethodType ($method_type)
 
 setValidationEnforced ($must_validate=TRUE)
 
 isValidationEnforced ()
 
 disableRedirect ($no_redirect=TRUE)
 
 isRedirectDisabled ()
 
 setProcessInput ($process_input=TRUE)
 
 isProcessingInput ()
 
 setProgrammed ($programmed=TRUE)
 
 isProgrammed ()
 
 setProgrammedBypassAccessCheck ($programmed_bypass_access_check=TRUE)
 
 isBypassingProgrammedAccessChecks ()
 
 setRebuildInfo (array $rebuild_info)
 
 getRebuildInfo ()
 
 addRebuildInfo ($property, $value)
 
 setSubmitHandlers (array $submit_handlers)
 
 getSubmitHandlers ()
 
 setSubmitted ()
 
 isSubmitted ()
 
 setTemporary (array $temporary)
 
 getTemporary ()
 
getTemporaryValue ($key)
 
 setTemporaryValue ($key, $value)
 
 hasTemporaryValue ($key)
 
 setTriggeringElement ($triggering_element)
 
getTriggeringElement ()
 
 setValidateHandlers (array $validate_handlers)
 
 getValidateHandlers ()
 
 setValidationComplete ($validation_complete=TRUE)
 
 isValidationComplete ()
 
 getCleanValueKeys ()
 
 setCleanValueKeys (array $keys)
 
 addCleanValueKey ($key)
 
 cleanValues ()
 

Static Public Member Functions

static hasAnyErrors ()
 

Detailed Description

Provides an interface for an object containing the current state of a form.

This is passed to all form related code so that the caller can use it to examine what in the form changed when the form submission process is complete. Furthermore, it may be used to store information related to the processed data in the form, which will persist across page requests when the 'cache' or 'rebuild' flag is set. See ::$internalStorage for documentation of the available flags.

See Also

Member Function Documentation

addBuildInfo (   $property,
  $value 
)

Adds a value to the build info.

Parameters
string$propertyThe property to use for the value.
mixed$valueThe value to set.
Returns
$this

Implemented in FormState.

Referenced by FormTestStorageForm\buildForm(), FormBuilder\getFormId(), FormBuilder\retrieveForm(), and FormBuilder\submitForm().

Here is the caller graph for this function:

addCleanValueKey (   $key)

Adds a key to the array of form values that will be cleaned.

Parameters
string$keyThe form value key to be cleaned.
Returns
$this

Implemented in FormState.

Referenced by FormTestFormStateValuesCleanForm\cleanValue(), and VerticalTabs\processVerticalTabs().

Here is the caller graph for this function:

addRebuildInfo (   $property,
  $value 
)

Adds a value to the rebuild info.

Parameters
string$propertyThe property to use for the value.
mixed$valueThe value to set.
Returns
$this

Implemented in FormState.

cleanValues ( )

Removes internal Form API elements and buttons from submitted form values.

This function can be used when a module wants to store all submitted form values, for example, by serializing them into a single database column. In such cases, all internal Form API values and all form button elements should not be contained, and this function allows their removal before the module proceeds to storage. Next to button elements, the following internal values are removed by default.

  • form_id
  • form_token
  • form_build_id
  • op
Returns
$this

Implemented in FormState.

Referenced by FormTestFormStateValuesCleanAdvancedForm\submitForm(), FormTestVerticalTabsForm\submitForm(), FormTestFormStateValuesCleanForm\submitForm(), RegisterForm\submitForm(), ImageEffectFormBase\submitForm(), PathFormBase\submitForm(), EntityForm\submitForm(), and FormBuilderTest\testFormCacheDeletionCached().

Here is the caller graph for this function:

clearErrors ( )

Clears all errors against all form elements made by self::setErrorByName().

Implemented in FormState.

Referenced by FormBuilder\submitForm().

Here is the caller graph for this function:

disableCache ( )

Prevents the form from being cached.

Returns
$this

Implemented in FormState.

Referenced by ViewPreviewForm\form(), and ViewEditForm\form().

Here is the caller graph for this function:

disableRedirect (   $no_redirect = TRUE)

Prevents the form from redirecting.

Parameters
bool$no_redirectIf TRUE, the form will not redirect.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\buildForm(), FormTestRedirectForm\submitForm(), and FormTestCheckboxesZeroForm\submitForm().

Here is the caller graph for this function:

& get (   $property)

Gets any arbitrary property.

Parameters
string | array$propertyProperties are often stored as multi-dimensional associative arrays. If $property is a string, it will return $storage[$property]. If $property is an array, each element of the array will be used as a nested key. If $property = ['foo', 'bar'] it will return $storage['foo']['bar'].
Returns
mixed A reference to the value for that property, or NULL if the property does not exist.

Implemented in FormState.

Referenced by FilterPluginBase\addGroupForm(), FilterPluginBase\buildExposedFiltersGroupForm(), EntityDisplayFormBase\buildFieldRow(), BatchTestMultiStepForm\buildForm(), Analyze\buildForm(), EditDetails\buildForm(), ViewFormBase\buildForm(), RearrangeFilter\buildForm(), AddHandler\buildForm(), Rearrange\buildForm(), ConfigHandlerExtra\buildForm(), ConfigHandlerGroup\buildForm(), Display\buildForm(), EditorImageDialog\buildForm(), QuickEditFieldForm\buildForm(), FieldStorageAddForm\buildForm(), ViewsForm\buildForm(), HandlerBase\buildGroupByForm(), FilterPluginBase\buildGroupForm(), FilterPluginBase\buildGroupValidate(), DisplayExtenderTest\buildOptionsForm(), DisplayTest\buildOptionsForm(), RowPluginBase\buildOptionsForm(), AreaPluginBase\buildOptionsForm(), Attachment\buildOptionsForm(), Block\buildOptionsForm(), Feed\buildOptionsForm(), Page\buildOptionsForm(), PathPluginBase\buildOptionsForm(), DisplayPluginBase\buildOptionsForm(), EntityDisplayFormBase\copyFormValuesToEntity(), FieldItemList\defaultValueWidget(), HandlerBase\displayExposedForm(), ContentTranslationHandler\entityFormSharedElements(), ExposedFormPluginBase\exposedFormSubmit(), ViewPreviewForm\form(), FieldStorageConfigEditForm\form(), ContentEntityForm\getFormDisplay(), ContentEntityForm\getFormLangcode(), ViewsForm\getFormObject(), ViewUI\getOverrideValues(), ContentTranslationHandler\getSourceLangcode(), ViewUI\getStandardButtons(), ContentEntityForm\isDefaultFormLangcode(), WidgetBase\isDefaultValueWidget(), EntityDisplayFormBase\multistepSubmit(), DisplayPluginBase\optionsOverride(), ConfigHandler\remove(), TermForm\save(), FieldStorageConfigEditForm\save(), FilterPluginBase\showBuildGroupForm(), HandlerBase\showExposeForm(), QuickEditFieldForm\simplify(), ViewUI\standardSubmit(), ViewEditForm\submitDisplayDelete(), ViewEditForm\submitDisplayDisable(), ViewEditForm\submitDisplayEnable(), ViewEditForm\submitDisplayUndoDelete(), FormTestStatePersistForm\submitForm(), BatchTestMultiStepForm\submitForm(), EditDetails\submitForm(), ConfigHandlerGroup\submitForm(), ConfigHandlerExtra\submitForm(), Display\submitForm(), UserLoginForm\submitForm(), UpdateSettingsForm\submitForm(), Rearrange\submitForm(), SiteSettingsForm\submitForm(), NegotiationBrowserForm\submitForm(), ConfigHandler\submitForm(), RearrangeFilter\submitForm(), ConfigSync\submitForm(), BlockForm\submitForm(), OverviewTerms\submitForm(), EntityDisplayFormBase\submitForm(), HandlerBase\submitGroupByForm(), ViewUI\submitItemAdd(), DisplayExtenderTest\submitOptionsForm(), DisplayTest\submitOptionsForm(), Attachment\submitOptionsForm(), Block\submitOptionsForm(), Feed\submitOptionsForm(), PathPluginBase\submitOptionsForm(), Page\submitOptionsForm(), MenuForm\submitOverviewForm(), HandlerBase\submitTemporaryForm(), FilterPluginBase\validateExposeForm(), UserLoginForm\validateFinal(), Display\validateForm(), ConfigHandlerExtra\validateForm(), QuickEditFieldForm\validateForm(), ConfigHandler\validateForm(), DrupalImage\validateImageUploadSettings(), Callbacks\validateName(), DisplayTest\validateOptionsForm(), PathPluginBase\validateOptionsForm(), Page\validateOptionsForm(), DisplayPluginBase\validateOptionsForm(), BlockForm\validateVisibility(), Date\valueForm(), Equality\valueForm(), NumericFilter\valueForm(), and StringFilter\valueForm().

getAlwaysProcess ( )

Determines if this form should always be processed.

Returns
bool TRUE if the form should always be processed, FALSE otherwise.

Implemented in FormState.

Referenced by FormBuilder\buildForm(), and FormBuilder\processForm().

Here is the caller graph for this function:

getBuildInfo ( )

Returns the build info for the form.

Returns
array An array of build info.
See Also
::$build_info

Implemented in FormState.

Referenced by FormCache\getCache(), FormCache\loadCachedFormState(), FormBuilder\prepareForm(), FormBuilder\retrieveForm(), SelectLanguageForm\submitForm(), ViewsFormMainForm\submitForm(), FormBuilder\submitForm(), and ViewsFormMainForm\validateForm().

Here is the caller graph for this function:

getButtons ( )

Returns the submit and button elements for the form.

Returns
array The submit and button elements.

Implemented in FormState.

Referenced by FormBuilder\doBuildForm(), FormBuilder\handleInputElement(), and FormBuilder\processForm().

Here is the caller graph for this function:

getCacheableArray ( )

Returns an array representation of the cacheable portion of the form state.

Returns
array The cacheable portion of the form state.

Implemented in FormState.

Referenced by FormBuilder\buildForm(), and FormCache\setCache().

Here is the caller graph for this function:

getCleanValueKeys ( )

Gets the keys of the form values that will be cleaned.

Returns
array An array of form value keys to be cleaned.

Implemented in FormState.

& getCompleteForm ( )

Returns a reference to the complete form array.

Returns
array The complete form array.

Implemented in FormState.

Referenced by FormBuilder\doBuildForm(), FormValidator\doValidateForm(), MachineName\processMachineName(), and ResponsiveImageStyleForm\validateForm().

Here is the caller graph for this function:

getError ( array  $element)

Returns the error message filed against the given form element.

Form errors higher up in the form structure override deeper errors as well as errors on the element itself.

Parameters
array$elementThe form element to check for errors.
Returns
string|null Either the error message for this element or NULL if there are no errors.

Implemented in FormState.

Referenced by FormErrorHandler\setElementErrorsFromFormState().

Here is the caller graph for this function:

getErrors ( )

Returns an associative array of all errors.

Returns
array An array of all errors, keyed by the name of the form element.

Implemented in FormState.

Referenced by FormErrorHandler\displayErrorMessages(), FormErrorHandler\handleFormErrors(), BlockBase\submitConfigurationForm(), EditorLinkDialog\submitForm(), EditorImageDialog\submitForm(), Display\validateForm(), ConfigHandler\validateForm(), and ConfigSingleImportForm\validateForm().

Here is the caller graph for this function:

getFormObject ( )
& getGroups ( )

Returns references to details elements to render them within vertical tabs.

Returns
array

Implemented in FormState.

Referenced by RenderElement\processGroup().

Here is the caller graph for this function:

getLimitValidationErrors ( )

Retrieves the limited validation error sections.

Returns
array|null The limited validation error sections.
See Also
::$limit_validation_errors

Implemented in FormState.

getRebuildInfo ( )

Gets the rebuild info.

Returns
array The rebuild info.
See Also
::$rebuild_info

Implemented in FormState.

Referenced by FormBuilder\rebuildForm().

Here is the caller graph for this function:

getRedirect ( )

Gets the value to use for redirecting after the form has been executed.

See Also
::redirectForm()
Returns
mixed The value will be one of the following:
  • A fully prepared .
  • An instance of to use for the redirect.
  • NULL, to signify that no redirect was specified and that the current path should be used for the redirect.
  • FALSE, to signify that no redirect should take place.

Implemented in FormState.

Referenced by FormSubmitter\redirectForm(), and ViewEditForm\submitDelayDestination().

Here is the caller graph for this function:

getResponse ( )

Gets a response for this form.

If a response is set, it will be used during processing and returned directly. The form will not be rebuilt or redirected.

Returns
|null The response to return, or NULL.

Implemented in FormState.

Referenced by FormSubmitter\doSubmitForm(), FormBuilderTest\testHandleFormStateResponse(), and FormBuilderTest\testHandleRedirectWithResponse().

Here is the caller graph for this function:

& getStorage ( )

Returns the entire set of arbitrary data.

Returns
array The entire set of arbitrary data to store for this form.

Implemented in FormState.

Referenced by FormTestStorageForm\buildForm(), WidgetBase\getWidgetState(), and WidgetBase\setWidgetState().

Here is the caller graph for this function:

getSubmitHandlers ( )

Gets the submit handlers.

Returns
array An array of submit handlers.

Implemented in FormState.

Referenced by FormSubmitter\executeSubmitHandlers().

Here is the caller graph for this function:

getTemporary ( )

Gets temporary data.

Returns
array Temporary data accessible during the current page request only.

Implemented in FormState.

Referenced by FormBuilder\buildForm().

Here is the caller graph for this function:

& getTemporaryValue (   $key)

Gets an arbitrary value from temporary storage.

Parameters
string | array$keyProperties are often stored as multi-dimensional associative arrays. If $key is a string, it will return $temporary[$key]. If $key is an array, each element of the array will be used as a nested key. If $key = ['foo', 'bar'] it will return $temporary['foo']['bar'].
Returns
mixed A reference to the value for that key, or NULL if the property does not exist.

Implemented in FormState.

Referenced by ConditionPluginBase\buildConfigurationForm(), and BlockBase\buildConfigurationForm().

Here is the caller graph for this function:

& getTriggeringElement ( )
& getUserInput ( )

Returns the form values as they were submitted by the user.

These are raw and unvalidated, so should not be used without a thorough understanding of security implications. In almost all cases, code should use self::getValues() and self::getValue() exclusively.

Returns
array An associative array of values submitted to the form.

Implemented in FormState.

Referenced by FormTestProgrammaticForm\buildForm(), FormTestStorageForm\buildForm(), EditorLinkDialog\buildForm(), SiteSettingsForm\buildForm(), EditorImageDialog\buildForm(), ConfigSync\buildForm(), FormBuilder\buildForm(), FormBuilder\buttonWasClicked(), FormBuilder\doBuildForm(), FormBuilder\elementTriggeredScriptedSubmission(), ExposedFormPluginBase\exposedFormAlter(), ViewPreviewForm\form(), ImageStyleEditForm\form(), WizardPluginBase\getSelected(), FilterPluginBase\groupForm(), FormBuilder\handleInputElement(), FormBuilder\processForm(), FormTestBase\simulateFormSubmission(), BookAdminEditForm\submitForm(), MenuForm\submitOverviewForm(), PasswordConfirm\validatePasswordConfirm(), ImageWidget\validateRequiredFields(), ImageButton\valueCallback(), Equality\valueForm(), NumericFilter\valueForm(), and StringFilter\valueForm().

Here is the caller graph for this function:

getValidateHandlers ( )

Gets the validate handlers.

Returns
array An array of validate handlers.

Implemented in FormState.

Referenced by FormValidator\executeValidateHandlers().

Here is the caller graph for this function:

& getValue (   $key,
  $default = NULL 
)

Returns the submitted form value for a specific key.

Parameters
string | array$keyValues are stored as a multi-dimensional associative array. If $key is a string, it will return $values[$key]. If $key is an array, each element of the array will be used as a nested key. If $key = array('foo', 'bar') it will return $values['foo']['bar'].
mixed$default(optional) The default value if the specified key does not exist.
Returns
mixed The value for the given key, or NULL.

Implemented in FormState.

Referenced by BookManager\addFormElements(), BatchTestChainedForm\batchTestChainedFormSubmit1(), BatchTestChainedForm\batchTestChainedFormSubmit2(), BatchTestChainedForm\batchTestChainedFormSubmit3(), BatchTestChainedForm\batchTestChainedFormSubmit4(), WizardPluginBase\blockDisplayOptions(), TestBlockInstantiation\blockSubmit(), ForumBlockBase\blockSubmit(), BookNavigationBlock\blockSubmit(), BlockContentBlock\blockSubmit(), LocalTasksBlock\blockSubmit(), ViewsBlockBase\blockSubmit(), Block\blockSubmit(), ForumForm\buildEntity(), TermForm\buildEntity(), FieldStorageConfigEditForm\buildEntity(), AjaxFormsTestValidationForm\buildForm(), FileTransferAuthorizeForm\buildForm(), ConfigSingleExportForm\buildForm(), FilterPluginBase\buildGroupSubmit(), Date\buildGroupValidate(), FilterPluginBase\buildGroupValidate(), Callbacks\checkboxCallback(), FormTestStorageForm\continueSubmitForm(), LanguageAddForm\copyFormValuesToEntity(), WizardPluginBase\defaultDisplayFiltersUser(), WizardPluginBase\defaultDisplaySortsUser(), DateTimeFieldItemList\defaultValuesFormSubmit(), DateTimeFieldItemList\defaultValuesFormValidate(), EditForm\deleteSubmit(), ImageStyleEditForm\effectSave(), ImageStyleEditForm\effectValidate(), FormTestStorageForm\elementValidateValueCached(), ContentTranslationHandler\entityFormEntityBuild(), ContentTranslationHandler\entityFormSourceChange(), ContentTranslationHandler\entityFormValidate(), ExposedFormPluginBase\exposedFormSubmit(), ViewsMenuLinkForm\extractFormValues(), MenuLinkDefaultForm\extractFormValues(), FieldStorageAddForm\fieldNameExists(), ViewPreviewForm\form(), LanguageAddForm\form(), ViewUI\getOverrideValues(), FormValidator\handleErrorsWithLimitedValidation(), WizardPluginBase\instantiateView(), EntityDisplayFormBase\multistepAjax(), EntityDisplayFormBase\multistepSubmit(), WizardPluginBase\pageDisplayOptions(), WizardPluginBase\pageFeedDisplayOptions(), VerticalTabs\processVerticalTabs(), WizardPluginBase\restExportDisplayOptions(), RegisterForm\save(), BookOutlineForm\save(), TermForm\save(), ContactFormEditForm\save(), Callbacks\selectCallback(), CKEditor\settingsFormSubmit(), UserRole\submitConfigurationForm(), ConditionPluginBase\submitConfigurationForm(), ChangeUserRoleBase\submitConfigurationForm(), ConvertImageEffect\submitConfigurationForm(), CropImageEffect\submitConfigurationForm(), ResizeImageEffect\submitConfigurationForm(), ScaleImageEffect\submitConfigurationForm(), Language\submitConfigurationForm(), TestProcessor\submitConfigurationForm(), MessageAction\submitConfigurationForm(), SearchExtraTypeSearch\submitConfigurationForm(), TestToolkit\submitConfigurationForm(), RotateImageEffect\submitConfigurationForm(), VariantBase\submitConfigurationForm(), GotoAction\submitConfigurationForm(), EmailAction\submitConfigurationForm(), BlockBase\submitConfigurationForm(), FormTestTableSelectMultipleFalseForm\submitForm(), FormTestTableSelectMultipleTrueForm\submitForm(), BatchTestMockForm\submitForm(), SessionTestForm\submitForm(), ImageStyleDeleteForm\submitForm(), BatchTestSimpleForm\submitForm(), NegotiationSelectedForm\submitForm(), NegotiationSessionForm\submitForm(), FormTestRedirectForm\submitForm(), FormTestArgumentsObject\submitForm(), FormTestServiceObject\submitForm(), PathFilterForm\submitForm(), FormTestObject\submitForm(), BookSettingsForm\submitForm(), ViewDuplicateForm\submitForm(), FileModuleTestForm\submitForm(), ForumSettingsForm\submitForm(), FormTestControllerObject\submitForm(), RegisterForm\submitForm(), DblogFilterForm\submitForm(), FileTestForm\submitForm(), ConfigImportForm\submitForm(), TranslateFilterForm\submitForm(), ActionAdminManageForm\submitForm(), SelectProfileForm\submitForm(), AdvancedSettingsForm\submitForm(), SelectLanguageForm\submitForm(), BookAdminEditForm\submitForm(), LocaleSettingsForm\submitForm(), ConfigHandlerExtra\submitForm(), ImageEffectFormBase\submitForm(), BanAdmin\submitForm(), UpdateReady\submitForm(), UserCancelForm\submitForm(), ExportForm\submitForm(), UpdateManagerInstall\submitForm(), UserPasswordForm\submitForm(), FormTestStorageForm\submitForm(), UpdateSettingsForm\submitForm(), LanguageListBuilder\submitForm(), ContentLanguageSettingsForm\submitForm(), Rearrange\submitForm(), DraggableListBuilder\submitForm(), NegotiationConfigureForm\submitForm(), BasicSettingsForm\submitForm(), UserMultipleCancelConfirm\submitForm(), ImportForm\submitForm(), TranslateEditForm\submitForm(), FileTransferAuthorizeForm\submitForm(), ConfigTranslationFormBase\submitForm(), UserPermissionsForm\submitForm(), EditorImageDialog\submitForm(), PathFormBase\submitForm(), NegotiationUrlForm\submitForm(), ConfigHandler\submitForm(), RearrangeFilter\submitForm(), ImageStyleEditForm\submitForm(), SiteConfigureForm\submitForm(), TranslationStatusForm\submitForm(), UpdateManagerUpdate\submitForm(), BlockForm\submitForm(), OverviewTerms\submitForm(), AccountSettingsForm\submitForm(), HandlerBase\submitGroupByForm(), ViewUI\submitItemAdd(), InputRequired\submitOptionsForm(), DisplayExtenderTest\submitOptionsForm(), Fields\submitOptionsForm(), NodeTermData\submitOptionsForm(), Serializer\submitOptionsForm(), DisplayTest\submitOptionsForm(), Entity\submitOptionsForm(), NumericField\submitOptionsForm(), Attachment\submitOptionsForm(), Block\submitOptionsForm(), Feed\submitOptionsForm(), ArgumentPluginBase\submitOptionsForm(), PathPluginBase\submitOptionsForm(), Page\submitOptionsForm(), FieldPluginBase\submitOptionsForm(), HandlerBase\submitTemporaryForm(), BlockForm\themeSwitch(), ConfigSingleExportForm\updateConfigurationType(), ConfigSingleExportForm\updateExport(), FieldStorageAddForm\validateAddExisting(), FieldStorageAddForm\validateAddNew(), UserLoginForm\validateAuthentication(), LanguageFormBase\validateCommon(), TestToolkit\validateConfigurationForm(), RotateImageEffect\validateConfigurationForm(), EmailAction\validateConfigurationForm(), DefaultSelection\validateConfigurationForm(), LanguageAddForm\validateCustom(), FilterPluginBase\validateExposeForm(), UserLoginForm\validateFinal(), EntityDisplayModeAddForm\validateForm(), TestForm\validateForm(), FormTestValidateForm\validateForm(), BookSettingsForm\validateForm(), BookAdminEditForm\validateForm(), LocaleSettingsForm\validateForm(), FormValidator\validateForm(), TermForm\validateForm(), ImageEffectFormBase\validateForm(), BanAdmin\validateForm(), UpdateSettingsForm\validateForm(), ContactFormEditForm\validateForm(), UserPasswordForm\validateForm(), UpdateManagerInstall\validateForm(), LanguageListBuilder\validateForm(), NegotiationUrlForm\validateForm(), SiteSettingsForm\validateForm(), FieldStorageConfigEditForm\validateForm(), NegotiationBrowserForm\validateForm(), TranslateEditForm\validateForm(), PathFormBase\validateForm(), FileTransferAuthorizeForm\validateForm(), ViewAddForm\validateForm(), ResponsiveImageStyleForm\validateForm(), FieldStorageAddForm\validateForm(), SiteConfigureForm\validateForm(), TranslationStatusForm\validateForm(), ConfigSingleImportForm\validateForm(), BlockForm\validateForm(), UpdateManagerUpdate\validateForm(), DrupalImage\validateImageUploadSettings(), Callbacks\validateName(), UserLoginForm\validateName(), Date\validateOptionsForm(), Serialized\validateOptionsForm(), DisplayTest\validateOptionsForm(), Role\validateOptionsForm(), DataFieldRow\validateOptionsForm(), Time\validateOptionsForm(), SqlBase\validateOptionsForm(), StylePluginBase\validateOptionsForm(), ArgumentPluginBase\validateOptionsForm(), PathPluginBase\validateOptionsForm(), Page\validateOptionsForm(), DisplayPluginBase\validateOptionsForm(), LanguageAddForm\validatePredefined(), and BlockForm\validateVisibility().

& getValues ( )

Returns the submitted and sanitized form values.

Returns
array An associative array of values submitted to the form.

Implemented in FormState.

Referenced by ContentEntityForm\copyFormValuesToEntity(), EntityForm\copyFormValuesToEntity(), EntityDisplayFormBase\copyFormValuesToEntity(), WidgetBase\extractFormValues(), FormValidator\handleErrorsWithLimitedValidation(), FormBuilder\handleInputElement(), WizardPluginBase\retrieveValidatedView(), TermForm\save(), WizardPluginBase\setValidatedView(), FormTestColorForm\submitForm(), FormTestInputForgeryForm\submitForm(), FormTestResponseForm\submitForm(), FormTestEmailForm\submitForm(), FormTestUrlForm\submitForm(), FormTestVerticalTabsForm\submitForm(), FormTestCheckboxesZeroForm\submitForm(), FormTestFormStateValuesCleanForm\submitForm(), FormTestLanguageSelectForm\submitForm(), FormTestRangeForm\submitForm(), EditDetails\submitForm(), EditorLinkDialog\submitForm(), FormTestCheckboxesRadiosForm\submitForm(), FormTestCheckboxForm\submitForm(), FormTestRebuildPreserveValuesForm\submitForm(), FormTestProgrammaticForm\submitForm(), LocaleSettingsForm\submitForm(), UserCancelForm\submitForm(), FormTestSelectForm\submitForm(), UserMultipleCancelConfirm\submitForm(), EditorImageDialog\submitForm(), FormTestDisabledElementsForm\submitForm(), FieldStorageAddForm\submitForm(), FormBuilder\submitForm(), EntityDisplayFormBase\submitForm(), Sql\submitOptionsForm(), Datelist\validateDatelist(), Datetime\validateDatetime(), and FormTestVerticalTabsAccessForm\validateForm().

Here is the caller graph for this function:

has (   $property)

Determines if an arbitrary property is present.

Parameters
string$propertyProperties are often stored as multi-dimensional associative arrays. If $property is a string, it will return isset($storage[$property]). If $property is an array, each element of the array will be used as a nested key. If $property = ['foo', 'bar'] it will return isset($storage['foo']['bar']).

Implemented in FormState.

Referenced by FormTestRebuildPreserveValuesForm\buildForm(), ViewFormBase\buildForm(), QuickEditFieldForm\buildForm(), EntityForm\buildForm(), MenuForm\buildOverviewForm(), FieldItemList\defaultValueWidget(), ContentEntityForm\initFormLangcodes(), FormTestCheckboxesZeroForm\submitForm(), FormTestStorageForm\submitForm(), and Callbacks\validateName().

Here is the caller graph for this function:

static hasAnyErrors ( )
static

Determines if any forms have any errors.

Returns
bool TRUE if any form has any errors, FALSE otherwise.

Implemented in FormState.

Referenced by FormTestStoragePageCacheForm\validateForm().

Here is the caller graph for this function:

hasFileElement ( )

Returns whether this form has a file element.

Returns
bool Whether this form has a file element.

Implemented in FormState.

Referenced by FormBuilder\doBuildForm().

Here is the caller graph for this function:

hasInvalidToken ( )

Determines if the form has an invalid token.

Returns
bool TRUE if the form has an invalid token, FALSE otherwise.

Implemented in FormState.

Referenced by FormBuilder\handleInputElement(), and FormValidator\validateForm().

Here is the caller graph for this function:

hasTemporaryValue (   $key)

Determines if a temporary value is present.

Parameters
string$keyProperties are often stored as multi-dimensional associative arrays. If $key is a string, it will return isset($temporary[$key]). If $key is an array, each element of the array will be used as a nested key. If $key = ['foo', 'bar'] it will return isset($temporary['foo']['bar']).

Implemented in FormState.

hasValue (   $key)

Determines if a specific key is present in the submitted form values.

Parameters
string | array$keyValues are stored as a multi-dimensional associative array. If $key is a string, it will return isset($values[$key]). If $key is an array, each element of the array will be used as a nested key. If $key = array('foo', 'bar') it will return isset($values['foo']['bar']).
Returns
bool TRUE if the $key is set, FALSE otherwise.

Implemented in FormState.

Referenced by BookManager\addFormElements(), ViewUI\getOverrideValues(), FormTestLimitValidationErrorsForm\partialSubmitForm(), VerticalTabs\processVerticalTabs(), TermForm\save(), CKEditor\settingsFormSubmit(), DblogFilterForm\submitForm(), TranslateFilterForm\submitForm(), NegotiationConfigureForm\submitForm(), AccountSettingsForm\submitForm(), TermForm\validateForm(), NegotiationBrowserForm\validateForm(), ResponsiveImageStyleForm\validateForm(), and StylePluginBase\validateOptionsForm().

Here is the caller graph for this function:

isBypassingProgrammedAccessChecks ( )

Determines if this form submission should bypass #access.

Returns
bool
See Also
::$programmed_bypass_access_check

Implemented in FormState.

Referenced by FormBuilder\handleInputElement().

Here is the caller graph for this function:

isCached ( )

Determines if the form should be cached.

Returns
bool TRUE if the form should be cached, FALSE otherwise.

Implemented in FormState.

Referenced by FormBuilder\processForm(), and FormBuilder\rebuildForm().

Here is the caller graph for this function:

isExecuted ( )

Determines if the form was submitted and has been processed and executed.

Returns
bool TRUE if the form was submitted and has been processed and executed.

Implemented in FormState.

Referenced by FormBuilder\processForm().

Here is the caller graph for this function:

isMethodType (   $method_type)

Returns the HTTP form method.

Parameters
stringThe HTTP form method.
Returns
bool TRUE if the HTTP form method matches.
See Also
::$method

Implemented in FormState.

Referenced by FormBuilder\buildForm(), FormBuilder\prepareForm(), FormBuilder\processForm(), and FormBuilder\rebuildForm().

Here is the caller graph for this function:

isProcessingInput ( )

Determines if the form input will be processed.

Returns
bool If TRUE, the form input will be processed.

Implemented in FormState.

Referenced by EntityForm\afterBuild(), FormBuilder\buildForm(), FormBuilder\handleInputElement(), and FormBuilder\processForm().

Here is the caller graph for this function:

isProgrammed ( )

Returns if this form was submitted programmatically.

Returns
bool If TRUE, the form was submitted programmatically.

Implemented in FormState.

Referenced by FormBuilder\doBuildForm(), FormSubmitter\doSubmitForm(), WidgetBase\formMultipleElements(), FormBuilder\handleInputElement(), FormBuilder\prepareForm(), and FormBuilder\processForm().

Here is the caller graph for this function:

isRebuilding ( )

Determines if the form should be rebuilt after processing.

Returns
bool TRUE if the form should be rebuilt, FALSE otherwise.

Implemented in FormState.

Referenced by FormTestStorageForm\buildForm(), WizardPluginBase\getSelected(), FormBuilder\handleInputElement(), and FormBuilder\processForm().

Here is the caller graph for this function:

isRedirectDisabled ( )

Determines if redirecting has been prevented.

Returns
bool If TRUE, the form will not redirect.

Implemented in FormState.

isSubmitted ( )

Determines if the form has been submitted.

Returns
bool TRUE if the form has been submitted, FALSE otherwise.

Implemented in FormState.

Referenced by FormValidator\determineLimitValidationErrors(), and FormSubmitter\doSubmitForm().

Here is the caller graph for this function:

isValidationComplete ( )

Determines if validation has been completed.

Returns
bool TRUE if validation is complete, FALSE otherwise.

Implemented in FormState.

Referenced by FormValidator\validateForm().

Here is the caller graph for this function:

isValidationEnforced ( )

Checks if validation is enforced.

Returns
bool If TRUE, validation will always be run.

Implemented in FormState.

Referenced by FormValidator\validateForm().

Here is the caller graph for this function:

isValueEmpty (   $key)

Determines if a specific key has a value in the submitted form values.

Parameters
string | array$keyValues are stored as a multi-dimensional associative array. If $key is a string, it will return empty($values[$key]). If $key is an array, each element of the array will be used as a nested key. If $key = array('foo', 'bar') it will return empty($values['foo']['bar']).
Returns
bool TRUE if the $key has no value, FALSE otherwise.

Implemented in FormState.

Referenced by ViewsBlockBase\blockSubmit(), WizardPluginBase\buildDisplayOptions(), FilterPluginBase\buildExposedFiltersGroupForm(), FilterPluginBase\buildGroupValidate(), ContentTranslationHandler\entityFormValidate(), ExposedFormPluginBase\exposedFormSubmit(), ViewPreviewForm\form(), EntityTestForm\save(), RegisterForm\save(), BlockContentForm\save(), FormTestRedirectForm\submitForm(), FileTestForm\submitForm(), UserCancelForm\submitForm(), NegotiationConfigureForm\submitForm(), ImageStyleEditForm\submitForm(), UpdateManagerUpdate\submitForm(), ViewUI\submitItemAdd(), UserLoginForm\validateAuthentication(), ScaleImageEffect\validateConfigurationForm(), RotateImageEffect\validateConfigurationForm(), BookSettingsForm\validateForm(), DblogFilterForm\validateForm(), FormTestProgrammaticForm\validateForm(), UpdateSettingsForm\validateForm(), ConfigSingleImportForm\validateForm(), UpdateManagerUpdate\validateForm(), UserLoginForm\validateName(), Date\validateOptionsForm(), SqlBase\validateOptionsForm(), Page\validateOptionsForm(), and DisplayPluginBase\validateOptionsForm().

Here is the caller graph for this function:

loadInclude (   $module,
  $type,
  $name = NULL 
)

Ensures an include file is loaded whenever the form is processed.

Example:

// Load node.admin.inc from Node module.
$form_state->loadInclude('node', 'inc', 'node.admin');

Use this function instead of module_load_include() from inside a form constructor or any form processing logic as it ensures that the include file is loaded whenever the form is processed. In contrast to using module_load_include() directly, this method makes sure the include file is correctly loaded also if the form is cached.

Parameters
string$moduleThe module to which the include file belongs.
string$typeThe include file's type (file extension).
string | null$name(optional) The base file name (without the $type extension). If omitted, $module is used; i.e., resulting in "$module.$type" by default.
Returns
string|false The filepath of the loaded include file, or FALSE if the include file was not found or has been loaded already.
See Also
module_load_include()

Implemented in FormState.

Referenced by ViewFormBase\init(), and DrupalImage\settingsForm().

Here is the caller graph for this function:

prepareCallback (   $callback)

Converts support notations for a form callback to a valid callable.

Specifically, supports methods on the form/callback object as strings when they start with ::, for example "::submitForm()".

Parameters
string | array$callbackThe callback.
Returns
array|string A valid callable.

Implemented in FormState.

Referenced by FormBuilder\doBuildForm(), FormValidator\doValidateForm(), FormSubmitter\executeSubmitHandlers(), and FormValidator\executeValidateHandlers().

Here is the caller graph for this function:

set (   $property,
  $value 
)

Sets a value to an arbitrary property.

Parameters
string | array$propertyProperties are often stored as multi-dimensional associative arrays. If $property is a string, it will use $storage[$property] = $value. If $property is an array, each element of the array will be used as a nested key. If $property = ['foo', 'bar'] it will use $storage['foo']['bar'] = $value.
mixed$valueThe value to set.
Returns
$this

Implemented in FormState.

Referenced by FilterPluginBase\addGroupForm(), FormTestRebuildPreserveValuesForm\addMoreSubmitForm(), FilterPluginBase\buildExposedFiltersGroupForm(), BatchTestMultiStepForm\buildForm(), FormTestStatePersistForm\buildForm(), ContentTranslationDeleteForm\buildForm(), FormTestCheckboxesZeroForm\buildForm(), NestedEntityTestForm\buildForm(), Analyze\buildForm(), RearrangeFilter\buildForm(), FieldStorageConfigEditForm\buildForm(), ConfigHandlerExtra\buildForm(), Rearrange\buildForm(), ConfigHandlerGroup\buildForm(), EditorImageDialog\buildForm(), AccountSettingsForm\buildForm(), FieldStorageAddForm\buildForm(), ViewsForm\buildForm(), ConfigSync\buildForm(), FilterPluginBase\buildGroupForm(), MenuForm\buildOverviewForm(), FormTestStorageForm\continueSubmitForm(), EntityDisplayFormBase\copyFormValuesToEntity(), FieldItemList\defaultValueWidget(), HandlerBase\displayExposedForm(), FormTestStorageForm\elementValidateValueCached(), ExposedFormPluginBase\exposedFormAlter(), TermForm\form(), ViewEditForm\form(), MenuForm\form(), BlockForm\form(), ViewUI\getStandardButtons(), ViewFormBase\init(), QuickEditFieldForm\init(), EntityForm\init(), ContentEntityForm\initFormLangcodes(), EntityDisplayFormBase\multistepSubmit(), RegisterForm\save(), VocabularyForm\save(), TermForm\save(), BlockContentForm\save(), ContentEntityForm\setFormDisplay(), BatchTestMultiStepForm\submitForm(), EditDetails\submitForm(), FormTestProgrammaticForm\submitForm(), QuickEditFieldForm\submitForm(), FieldStorageAddForm\submitForm(), EntityDisplayFormBase\submitForm(), ViewPreviewForm\submitPreview(), FormBuilderTest\testHandleRedirectWithResponse(), ContentEntityForm\updateFormLangcode(), UserLoginForm\validateAuthentication(), Display\validateForm(), UpdateSettingsForm\validateForm(), SiteSettingsForm\validateForm(), NegotiationBrowserForm\validateForm(), ViewAddForm\validateForm(), ConfigHandler\validateForm(), ConfigSingleImportForm\validateForm(), and Callbacks\validateName().

setAlwaysProcess (   $always_process = TRUE)

Sets this form to always be processed.

This should only be used on RESTful GET forms that do NOT write data, as this could lead to security issues. It is useful so that searches do not need to have a form_id in their query arguments to trigger the search.

Parameters
bool$always_processTRUE if the form should always be processed, FALSE otherwise.
Returns
$this

Implemented in FormState.

setBuildInfo ( array  $build_info)

Sets the build info for the form.

Parameters
array$build_infoAn array of build info.
Returns
$this
See Also
::$build_info

Implemented in FormState.

Referenced by FormCache\getCache(), and SelectLanguageForm\submitForm().

Here is the caller graph for this function:

setButtons ( array  $buttons)

Stores the submit and button elements for the form.

Parameters
array$buttonsThe submit and button elements.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\handleInputElement().

Here is the caller graph for this function:

setCached (   $cache = TRUE)

Sets this form to be cached.

Parameters
bool$cacheTRUE if the form should be cached, FALSE otherwise.
Returns
$this
Exceptions
\LogicExceptionIf the current request is using an HTTP method that must not change state (e.g., GET).

Implemented in FormState.

Referenced by FormTestStorageForm\buildForm(), EditorImageDialog\buildForm(), FormBuilder\rebuildForm(), FormBuilderTest\testFormCacheDeletionCached(), FormTestValidateForm\validateForm(), FormTestStoragePageCacheForm\validateForm(), and FormTestStorageForm\validateForm().

Here is the caller graph for this function:

setCleanValueKeys ( array  $keys)

Sets the keys of the form values that will be cleaned.

Parameters
array$keysAn array of form value keys to be cleaned.
Returns
$this

Implemented in FormState.

setCompleteForm ( array &  $complete_form)

Stores the complete form array.

Parameters
array$complete_formThe complete form array.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\doBuildForm().

Here is the caller graph for this function:

setError ( array &  $element,
  $message = '' 
)

Flags an element as having an error.

Parameters
array$elementThe form element.
string$message(optional) The error message to present to the user.
Returns
$this

Implemented in FormState.

Referenced by Date\buildGroupValidate(), FilterPluginBase\buildGroupValidate(), FormValidator\doValidateForm(), FormTestLimitValidationErrorsForm\elementValidateLimitValidationErrors(), FormTestValidateRequiredForm\elementValidateRequired(), EntityAutocomplete\matchEntityByTitle(), FormValidator\performRequiredValidation(), ViewsSelection\settingsFormValidate(), DataFieldRow\validateAliasName(), ListItemBase\validateAllowedValues(), Color\validateColor(), Datelist\validateDatelist(), Datetime\validateDatetime(), OptionsWidgetBase\validateElement(), FilterPluginBase\validateExposeForm(), ResponsiveImageStyleForm\validateForm(), PathWidget\validateFormElement(), MachineName\validateMachineName(), Number\validateNumber(), Serialized\validateOptionsForm(), DisplayTest\validateOptionsForm(), Role\validateOptionsForm(), Time\validateOptionsForm(), PathPluginBase\validateOptionsForm(), Page\validateOptionsForm(), DisplayPluginBase\validateOptionsForm(), PasswordConfirm\validatePasswordConfirm(), FormElement\validatePattern(), ImageItem\validateResolution(), StylesCombo\validateStylesValue(), Table\validateTable(), LinkWidget\validateTitleElement(), LinkWidget\validateUriElement(), Url\validateUrl(), and Date\validateValidTime().

Here is the caller graph for this function:

setErrorByName (   $name,
  $message = '' 
)

Files an error against a form element.

When a validation error is detected, the validator calls this method to indicate which element needs to be changed and provide an error message. This causes the Form API to not execute the form submit handlers, and instead to re-display the form to the user with the corresponding elements rendered with an 'error' CSS class (shown as red by default).

The standard behavior of this method can be changed if a button provides the #limit_validation_errors property. Multistep forms not wanting to validate the whole form can set #limit_validation_errors on buttons to limit validation errors to only certain elements. For example, pressing the "Previous" button in a multistep form should not fire validation errors just because the current step has invalid values. If #limit_validation_errors is set on a clicked button, the button must also define a #submit property (may be set to an empty array). Any #submit handlers will be executed even if there is invalid input, so extreme care should be taken with respect to any actions taken by them. This is typically not a problem with buttons like "Previous" or "Add more" that do not invoke persistent storage of the submitted form values. Do not use the #limit_validation_errors property on buttons that trigger saving of form values to the database.

The #limit_validation_errors property is a list of "sections" within $form_state->getValues() that must contain valid values. Each "section" is an array with the ordered set of keys needed to reach that part of $form_state->getValues() (i.e., the #parents property of the element).

Example 1: Allow the "Previous" button to function, regardless of whether any user input is valid.

$form['actions']['previous'] = array(
'#type' => 'submit',
'#value' => t('Previous'),
'#limit_validation_errors' => array(), // No validation.
'#submit' => array('some_submit_function'), // #submit required.
);

Example 2: Require some, but not all, user input to be valid to process the submission of a "Previous" button.

$form['actions']['previous'] = array(
'#type' => 'submit',
'#value' => t('Previous'),
'#limit_validation_errors' => array(
// Validate $form_state->getValue('step1').
array('step1'),
// Validate $form_state->getValue(array('foo', 'bar')).
array('foo', 'bar'),
),
'#submit' => array('some_submit_function'), // #submit required.
);

This will require $form_state->getValue('step1') and everything within it (for example, $form_state->getValue(array('step1', 'choice'))) to be valid, so calls to self::setErrorByName('step1', $message) or self::setErrorByName('step1][choice', $message) will prevent the submit handlers from running, and result in the error message being displayed to the user. However, calls to self::setErrorByName('step2', $message) and self::setErrorByName('step2][groupX][choiceY', $message) will be suppressed, resulting in the message not being displayed to the user, and the submit handlers will run despite $form_state->getValue('step2') and $form_state->getValue(array('step2', 'groupX', 'choiceY')) containing invalid values. Errors for an invalid $form_state->getValue('foo') will be suppressed, but errors flagging invalid values for $form_state->getValue(array('foo', 'bar')) and everything within it will be flagged and submission prevented.

Partial form validation is implemented by suppressing errors rather than by skipping the input processing and validation steps entirely, because some forms have button-level submit handlers that call Drupal API functions that assume that certain data exists within $form_state->getValues(), and while not doing anything with that data that requires it to be valid, PHP errors would be triggered if the input processing and validation steps were fully skipped.

Parameters
string$nameThe name of the form element. If the #parents property of your form element is array('foo', 'bar', 'baz') then you may set an error on 'foo' or 'foo][bar][baz'. Setting an error on 'foo' sets an error for every element where the #parents array starts with 'foo'.
string$message(optional) The error message to present to the user.
Returns
$this

Implemented in FormState.

Referenced by Combine\buildOptionsForm(), DateTimeFieldItemList\defaultValuesFormValidate(), ImageStyleEditForm\effectValidate(), ContentTranslationHandler\entityFormValidate(), AccountForm\flagViolations(), FormValidator\setInvalidTokenError(), FieldStorageAddForm\validateAddExisting(), FieldStorageAddForm\validateAddNew(), LanguageFormBase\validateCommon(), ScaleImageEffect\validateConfigurationForm(), TestToolkit\validateConfigurationForm(), RotateImageEffect\validateConfigurationForm(), EmailAction\validateConfigurationForm(), LanguageAddForm\validateCustom(), UserLoginForm\validateFinal(), FormTestDetailsForm\validateForm(), TestForm\validateForm(), FormTestValidateForm\validateForm(), BookSettingsForm\validateForm(), DblogFilterForm\validateForm(), ConfigImportForm\validateForm(), BookAdminEditForm\validateForm(), FormTestProgrammaticForm\validateForm(), LocaleSettingsForm\validateForm(), TermForm\validateForm(), FormTestVerticalTabsAccessForm\validateForm(), BanAdmin\validateForm(), UpdateSettingsForm\validateForm(), ContactFormEditForm\validateForm(), UserPasswordForm\validateForm(), UpdateManagerInstall\validateForm(), LanguageListBuilder\validateForm(), NegotiationUrlForm\validateForm(), SiteSettingsForm\validateForm(), FieldStorageConfigEditForm\validateForm(), NegotiationBrowserForm\validateForm(), TranslateEditForm\validateForm(), ImportForm\validateForm(), PathFormBase\validateForm(), FileTransferAuthorizeForm\validateForm(), ViewAddForm\validateForm(), MessageForm\validateForm(), FieldStorageAddForm\validateForm(), ViewEditForm\validateForm(), SiteConfigureForm\validateForm(), TranslationStatusForm\validateForm(), ConfigSingleImportForm\validateForm(), UpdateManagerUpdate\validateForm(), Callbacks\validateName(), UserLoginForm\validateName(), DataFieldRow\validateOptionsForm(), SqlBase\validateOptionsForm(), and LanguageAddForm\validatePredefined().

setExecuted ( )

Sets that the form was submitted and has been processed and executed.

Returns
$this

Implemented in FormState.

Referenced by FormSubmitter\doSubmitForm().

Here is the caller graph for this function:

setFormObject ( FormInterface  $form_object)

Sets the form object that is responsible for building this form.

Parameters
\Drupal\Core\Form\FormInterface$form_objectThe form object.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\getFormId().

Here is the caller graph for this function:

setFormState ( array  $form_state_additions)

Sets the value of the form state.

Parameters
array$form_state_additionsAn array of values to add to the form state.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\buildForm(), FormCache\loadCachedFormState(), and FormBuilderTest\testHandleFormStateResponse().

Here is the caller graph for this function:

setGroups ( array  $groups)

Sets references to details elements to render them within vertical tabs.

Parameters
array$groupsReferences to details elements to render them within vertical tabs.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\rebuildForm().

Here is the caller graph for this function:

setHasFileElement (   $has_file_element = TRUE)

Sets that this form has a file element.

Parameters
bool$has_file_elementWhether this form has a file element.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\doBuildForm().

Here is the caller graph for this function:

setInvalidToken (   $invalid_token)

Flags the form state as having or not an invalid token.

Parameters
bool$invalid_tokenWhether the form has an invalid token.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\doBuildForm().

Here is the caller graph for this function:

setLimitValidationErrors (   $limit_validation_errors)

Sets the limited validation error sections.

Parameters
array | null$limit_validation_errorsThe limited validation error sections.
Returns
$this
See Also
::$limit_validation_errors

Implemented in FormState.

Referenced by FormValidator\doValidateForm(), and ImageWidget\validateRequiredFields().

Here is the caller graph for this function:

setMethod (   $method)

Sets the HTTP method to use for the form's submission.

This is what the form's "method" attribute should be, not necessarily what the current request's HTTP method is. For example, a form can have a method attribute of POST, but the request that initially builds it uses GET.

Parameters
string$methodEither "GET" or "POST". Other HTTP methods are not valid form submission methods.
See Also
::$method
::setRequestMethod()
Returns
$this

Implemented in FormState.

setProcessInput (   $process_input = TRUE)

Sets that the form should process input.

Parameters
bool$process_inputIf TRUE, the form input will be processed.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\doBuildForm().

Here is the caller graph for this function:

setProgrammed (   $programmed = TRUE)

Sets that this form was submitted programmatically.

Parameters
bool$programmedIf TRUE, the form was submitted programmatically.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\submitForm().

Here is the caller graph for this function:

setProgrammedBypassAccessCheck (   $programmed_bypass_access_check = TRUE)

Sets if this form submission should bypass #access.

Parameters
bool$programmed_bypass_access_checkIf TRUE, programmatic form submissions are processed without taking #access into account.
Returns
$this
See Also
::$programmed_bypass_access_check

Implemented in FormState.

setRebuildInfo ( array  $rebuild_info)

Sets the rebuild info.

Parameters
array$rebuild_infoThe rebuild info.
Returns
$this
See Also
::$rebuild_info

Implemented in FormState.

setRedirect (   $route_name,
array  $route_parameters = array(),
array  $options = array() 
)

Sets the redirect for the form.

Parameters
string$route_nameThe name of the route
array$route_parameters(optional) An associative array of parameter names and values.
array$options(optional) An associative array of additional options. See for the available keys.
Returns
$this
See Also
::redirectForm()

Implemented in FormState.

Referenced by BatchTestChainedForm\batchTestChainedFormSubmit1(), BatchTestChainedForm\batchTestChainedFormSubmit2(), BatchTestChainedForm\batchTestChainedFormSubmit3(), BatchTestChainedForm\batchTestChainedFormSubmit4(), NegotiationSessionForm\buildForm(), NegotiationUrlForm\buildForm(), ViewAddForm\cancel(), ProfileForm\editCancelSubmit(), ImageStyleEditForm\effectSave(), ContentTranslationHandler\entityFormSourceChange(), PathFilterForm\resetForm(), TranslateFilterForm\resetForm(), EntityTestForm\save(), RoleForm\save(), ForumForm\save(), RegisterForm\save(), BookOutlineForm\save(), MenuLinkContentForm\save(), ActionFormBase\save(), BlockContentForm\save(), MessageForm\save(), ViewEditForm\save(), ViewEditForm\submitDisplayAdd(), ViewEditForm\submitDisplayDisable(), ViewEditForm\submitDisplayDuplicate(), ViewEditForm\submitDisplayEnable(), ViewEditForm\submitDisplayUndoDelete(), ConfigExportForm\submitForm(), RedirectBlockForm\submitForm(), BatchTestSimpleForm\submitForm(), BatchTestMultiStepForm\submitForm(), PathFilterForm\submitForm(), AjaxTestDialogForm\submitForm(), NegotiationBrowserDeleteForm\submitForm(), DblogClearLogForm\submitForm(), ConfirmFormTestForm\submitForm(), ConfigImportForm\submitForm(), TranslateFilterForm\submitForm(), DeleteForm\submitForm(), ActionAdminManageForm\submitForm(), MenuLinkEditForm\submitForm(), BanAdmin\submitForm(), UserCancelForm\submitForm(), UserLoginForm\submitForm(), UserPasswordForm\submitForm(), FormTestStorageForm\submitForm(), NegotiationConfigureForm\submitForm(), UserMultipleCancelConfirm\submitForm(), ImportForm\submitForm(), TranslateEditForm\submitForm(), ConfigTranslationFormBase\submitForm(), PathFormBase\submitForm(), and BlockForm\submitForm().

setRedirectUrl ( Url  $url)

Sets the redirect URL for the form.

Parameters
\Drupal\Core\Url$urlThe URL to redirect to.
Returns
$this
See Also
::redirectForm()

Implemented in FormState.

Referenced by ViewEditForm\cancel(), EditForm\deleteSubmit(), TermTranslationHandler\entityFormSave(), ProfileTranslationHandler\entityFormSave(), LanguageEditForm\save(), ImageStyleFormBase\save(), LanguageAddForm\save(), BlockContentTypeForm\save(), BookOutlineForm\save(), VocabularyForm\save(), EntityDisplayModeFormBase\save(), ContactFormEditForm\save(), ConfigTestForm\save(), BlockContentForm\save(), FieldStorageConfigEditForm\save(), MenuForm\save(), FieldConfigEditForm\save(), MessageForm\save(), ViewEditForm\save(), ViewUI\standardCancel(), ViewEditForm\submitDelayDestination(), ViewEditForm\submitDisplayDelete(), ImageStyleFlushForm\submitForm(), FormTestRedirectForm\submitForm(), DeleteForm\submitForm(), DblogClearLogConfirmForm\submitForm(), ViewDuplicateForm\submitForm(), ImageEffectDeleteForm\submitForm(), VocabularyResetForm\submitForm(), BanDelete\submitForm(), FieldConfigDeleteForm\submitForm(), MenuLinkResetForm\submitForm(), BookRemoveForm\submitForm(), BreakLockForm\submitForm(), ImageEffectFormBase\submitForm(), UpdateReady\submitForm(), UserCancelForm\submitForm(), ConfigTranslationDeleteForm\submitForm(), UpdateManagerInstall\submitForm(), LanguageListBuilder\submitForm(), and FieldStorageAddForm\submitForm().

Here is the caller graph for this function:

setRequestMethod (   $method)

Sets the HTTP method used by the request that is building the form.

Parameters
string$methodCan be any valid HTTP method, such as GET, POST, HEAD, etc.
Returns
$this
See Also
::setMethod()

Implemented in FormState.

Referenced by FormTestStorageForm\buildForm(), FormBuilder\buildForm(), and FormBuilderTest\testFormCacheDeletionCached().

Here is the caller graph for this function:

setResponse ( Response  $response)

Sets a response for this form.

If a response is set, it will be used during processing and returned directly. The form will not be rebuilt or redirected.

Parameters
\Symfony\Component\HttpFoundation\Response$responseThe response to return.
Returns
$this

Implemented in FormState.

Referenced by FormSubmitter\doSubmitForm(), FormTestColorForm\submitForm(), FormTestResponseForm\submitForm(), FormTestEmailForm\submitForm(), FormTestUrlForm\submitForm(), FormTestCheckboxesZeroForm\submitForm(), FormTestLanguageSelectForm\submitForm(), FormTestRangeForm\submitForm(), FormTestCheckboxesRadiosForm\submitForm(), FormTestCheckboxForm\submitForm(), UpdateReady\submitForm(), FormTestSelectForm\submitForm(), ExportForm\submitForm(), UpdateManagerInstall\submitForm(), FileTransferAuthorizeForm\submitForm(), FormTestDisabledElementsForm\submitForm(), and FormBuilderTest\testHandleRedirectWithResponse().

Here is the caller graph for this function:

setStorage ( array  $storage)

Sets the entire set of arbitrary data.

Parameters
array$storageThe entire set of arbitrary data to store for this form.
Returns
$this

Implemented in FormState.

Referenced by FormTestStorageForm\buildForm().

Here is the caller graph for this function:

setSubmitHandlers ( array  $submit_handlers)

Sets the submit handlers.

Parameters
array$submit_handlersAn array of submit handlers.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\doBuildForm().

Here is the caller graph for this function:

setSubmitted ( )

Sets that the form has been submitted.

Returns
$this

Implemented in FormState.

Referenced by FormBuilder\doBuildForm(), and FormBuilder\submitForm().

Here is the caller graph for this function:

setTemporary ( array  $temporary)

Sets temporary data.

Parameters
array$temporaryTemporary data accessible during the current page request only.
Returns
$this

Implemented in FormState.

setTemporaryValue (   $key,
  $value 
)

Sets an arbitrary value in temporary storage.

Parameters
string | array$keyProperties are often stored as multi-dimensional associative arrays. If $key is a string, it will use $temporary[$key] = $value. If $key is an array, each element of the array will be used as a nested key. If $key = ['foo', 'bar'] it will use $temporary['foo']['bar'] = $value.
mixed$valueThe value to set.
Returns
$this

Implemented in FormState.

Referenced by BlockForm\form().

Here is the caller graph for this function:

setTriggeringElement (   $triggering_element)

Sets the form element that triggered submission.

Parameters
array | null$triggering_elementThe form element that triggered submission, of NULL if there is none.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\doBuildForm(), FormBuilder\handleInputElement(), and FormBuilder\processForm().

Here is the caller graph for this function:

setUserInput ( array  $user_input)

Sets the form values as though they were submitted by a user.

Parameters
array$user_inputAn associative array of raw and unvalidated values.
Returns
$this

Implemented in FormState.

Referenced by FormTestStorageForm\buildForm(), FormBuilder\buildForm(), ExposedFormPluginBase\exposedFormAlter(), FilterPluginBase\groupForm(), FormBuilder\processForm(), FormTestBase\simulateFormSubmission(), FormBuilder\submitForm(), FormBuilderTest\testHandleFormStateResponse(), FormBuilderTest\testHandleRedirectWithResponse(), Equality\valueForm(), NumericFilter\valueForm(), and StringFilter\valueForm().

Here is the caller graph for this function:

setValidateHandlers ( array  $validate_handlers)

Sets the validate handlers.

Parameters
array$validate_handlersAn array of validate handlers.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\doBuildForm().

Here is the caller graph for this function:

setValidationComplete (   $validation_complete = TRUE)

Sets that validation has been completed.

Parameters
bool$validation_completeTRUE if validation is complete, FALSE otherwise.
Returns
$this

Implemented in FormState.

Referenced by FormValidator\finalizeValidation(), and FormValidator\validateForm().

Here is the caller graph for this function:

setValidationEnforced (   $must_validate = TRUE)

Enforces that validation is run.

Parameters
bool$must_validateIf TRUE, validation will always be run.
Returns
$this

Implemented in FormState.

Referenced by FormBuilder\submitForm().

Here is the caller graph for this function:

setValue (   $key,
  $value 
)

Sets the submitted form value for a specific key.

Parameters
string | array$keyValues are stored as a multi-dimensional associative array. If $key is a string, it will use $values[$key] = $value. If $key is an array, each element of the array will be used as a nested key. If $key = array('foo', 'bar') it will use $values['foo']['bar'] = $value.
mixed$valueThe value to set.
Returns
$this

Implemented in FormState.

Referenced by FieldStorageConfigEditForm\buildEntity(), FilterPluginBase\buildGroupSubmit(), FormBuilder\doBuildForm(), ProfileForm\save(), ForumForm\save(), RegisterForm\save(), VocabularyForm\save(), TermForm\save(), BlockContentForm\save(), RegisterForm\submitForm(), FileTestForm\submitForm(), ImageEffectFormBase\submitForm(), EditorImageDialog\submitForm(), BlockForm\submitForm(), InputRequired\submitOptionsForm(), Fields\submitOptionsForm(), NodeTermData\submitOptionsForm(), Serializer\submitOptionsForm(), Entity\submitOptionsForm(), Attachment\submitOptionsForm(), DefaultSelection\validateConfigurationForm(), ConfigImportForm\validateForm(), ImageEffectFormBase\validateForm(), ContactFormEditForm\validateForm(), BlockForm\validateForm(), Role\validateOptionsForm(), PathPluginBase\validateOptionsForm(), and BlockForm\validateVisibility().

Here is the caller graph for this function:

setValueForElement ( array  $element,
  $value 
)

Changes submitted form values during form validation.

Use this function to change the submitted value of a form element in a form validation function, so that the changed value persists in $form_state through to the submission handlers.

Note that form validation functions are specified in the '#validate' component of the form array (the value of $form['#validate'] is an array of validation function names). If the form does not originate in your module, you can implement hook_form_FORM_ID_alter() to add a validation function to $form['#validate'].

Parameters
array$elementThe form element that should have its value updated; in most cases you can just pass in the element from the $form array, although the only component that is actually used is '#parents'. If constructing yourself, set $element['#parents'] to be an array giving the path through the form array's keys to the element whose value you want to update. For instance, if you want to update the value of $form['elem1']['elem2'], which should be stored in $form_state->getValue(array('elem1', 'elem2')), you would set $element['#parents'] = array('elem1','elem2').
mixed$valueThe new value for the form element.
Returns
$this

Implemented in FormState.

Referenced by DateTimeFieldItemList\defaultValuesFormSubmit(), DefaultSelection\elementValidateFilter(), FormBuilder\handleInputElement(), TestFieldWidgetMultiple\multipleValidate(), FormValidator\performRequiredValidation(), ViewsSelection\settingsFormValidate(), Sql\submitOptionsForm(), FieldStorageAddForm\validateAddNew(), ListItemBase\validateAllowedValues(), Color\validateColor(), Datelist\validateDatelist(), Datetime\validateDatetime(), ImageItem\validateDefaultImageForm(), OptionsWidgetBase\validateElement(), EntityDisplayModeAddForm\validateForm(), FormTestValidateForm\validateForm(), UserPasswordForm\validateForm(), ConfigSingleImportForm\validateForm(), PathWidget\validateFormElement(), Callbacks\validateName(), PasswordConfirm\validatePasswordConfirm(), ImageItem\validateResolution(), LinkWidget\validateUriElement(), and Url\validateUrl().

Here is the caller graph for this function:

setValues ( array  $values)

Sets the submitted form values.

This should be avoided, since these values have been validated already. Use self::setUserInput() instead.

Parameters
array$valuesThe multi-dimensional associative array of form values.
Returns
$this

Implemented in FormState.

Referenced by FormValidator\handleErrorsWithLimitedValidation(), and FormBuilder\processForm().

Here is the caller graph for this function:

unsetValue (   $key)

Removes a specific key from the submitted form values.

Parameters
string | array$keyValues are stored as a multi-dimensional associative array. If $key is a string, it will use unset($values[$key]). If $key is an array, each element of the array will be used as a nested key. If $key = array('foo', 'bar') it will use unset($values['foo']['bar']).
Returns
$this

Implemented in FormState.

Referenced by ViewsBlockBase\blockSubmit(), Block\blockSubmit(), CKEditor\settingsFormSubmit(), UserMultipleCancelConfirm\submitForm(), FileTransferAuthorizeForm\submitForm(), SortPluginBase\submitOptionsForm(), FilterPluginBase\submitOptionsForm(), BlockBase\validateConfigurationForm(), ResponsiveImageStyleForm\validateForm(), DrupalImage\validateImageUploadSettings(), and StylePluginBase\validateOptionsForm().

Here is the caller graph for this function:


The documentation for this interface was generated from the following file: