summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries2014-07-31 00:50:42 (GMT)
committerDries2014-07-31 00:50:42 (GMT)
commitfc5e111acaa34cea7dd24407c796810d340947c0 (patch)
treed475f50ed464155d26de2b0e992f69c0ef3f20fa
parent4d07e60aabc91670c92c2db8017528e80e061b35 (diff)
Issue #2225353 by tim.plunkett: Convert to an object and provide methods like setError().
-rw-r--r--core/includes/ajax.inc6
-rw-r--r--core/includes/batch.inc4
-rw-r--r--core/includes/form.inc82
-rw-r--r--core/includes/install.core.inc7
-rw-r--r--core/lib/Drupal/Core/Action/ConfigurableActionBase.php3
-rw-r--r--core/lib/Drupal/Core/Condition/ConditionPluginBase.php7
-rw-r--r--core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php7
-rw-r--r--core/lib/Drupal/Core/Controller/FormController.php3
-rw-r--r--core/lib/Drupal/Core/Display/VariantBase.php7
-rw-r--r--core/lib/Drupal/Core/Entity/ContentEntityConfirmFormBase.php7
-rw-r--r--core/lib/Drupal/Core/Entity/ContentEntityForm.php17
-rw-r--r--core/lib/Drupal/Core/Entity/ContentEntityFormInterface.php13
-rw-r--r--core/lib/Drupal/Core/Entity/Display/EntityFormDisplayInterface.php13
-rw-r--r--core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php5
-rw-r--r--core/lib/Drupal/Core/Entity/EntityForm.php53
-rw-r--r--core/lib/Drupal/Core/Entity/EntityFormBuilder.php4
-rw-r--r--core/lib/Drupal/Core/Entity/EntityFormBuilderInterface.php8
-rw-r--r--core/lib/Drupal/Core/Entity/EntityFormInterface.php35
-rw-r--r--core/lib/Drupal/Core/Field/FieldItemBase.php5
-rw-r--r--core/lib/Drupal/Core/Field/FieldItemInterface.php9
-rw-r--r--core/lib/Drupal/Core/Field/FieldItemList.php11
-rw-r--r--core/lib/Drupal/Core/Field/FieldItemListInterface.php13
-rw-r--r--core/lib/Drupal/Core/Field/FormatterBase.php4
-rw-r--r--core/lib/Drupal/Core/Field/FormatterInterface.php8
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php4
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php3
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php3
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php3
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php3
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/BooleanCheckboxWidget.php5
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php5
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php7
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php5
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringWidget.php5
-rw-r--r--core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/UriWidget.php5
-rw-r--r--core/lib/Drupal/Core/Field/WidgetBase.php31
-rw-r--r--core/lib/Drupal/Core/Field/WidgetBaseInterface.php23
-rw-r--r--core/lib/Drupal/Core/Field/WidgetInterface.php23
-rw-r--r--core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php7
-rw-r--r--core/lib/Drupal/Core/Form/ConfigFormBase.php8
-rw-r--r--core/lib/Drupal/Core/Form/ConfirmFormBase.php2
-rw-r--r--core/lib/Drupal/Core/Form/FormBase.php34
-rw-r--r--core/lib/Drupal/Core/Form/FormBuilder.php224
-rw-r--r--core/lib/Drupal/Core/Form/FormBuilderInterface.php237
-rw-r--r--core/lib/Drupal/Core/Form/FormErrorInterface.php29
-rw-r--r--core/lib/Drupal/Core/Form/FormInterface.php18
-rw-r--r--core/lib/Drupal/Core/Form/FormState.php748
-rw-r--r--core/lib/Drupal/Core/Form/FormStateInterface.php314
-rw-r--r--core/lib/Drupal/Core/Form/FormSubmitter.php127
-rw-r--r--core/lib/Drupal/Core/Form/FormSubmitterInterface.php26
-rw-r--r--core/lib/Drupal/Core/Form/FormValidator.php135
-rw-r--r--core/lib/Drupal/Core/Form/FormValidatorInterface.php22
-rw-r--r--core/lib/Drupal/Core/ImageToolkit/ImageToolkitInterface.php3
-rw-r--r--core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php5
-rw-r--r--core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php5
-rw-r--r--core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php7
-rw-r--r--core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php7
-rw-r--r--core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php9
-rw-r--r--core/lib/Drupal/Core/Menu/Form/MenuLinkFormInterface.php7
-rw-r--r--core/lib/Drupal/Core/Plugin/PluginFormInterface.php20
-rw-r--r--core/lib/Drupal/Core/Update/Form/UpdateScriptSelectionForm.php5
-rw-r--r--core/modules/action/src/ActionAddForm.php3
-rw-r--r--core/modules/action/src/ActionFormBase.php13
-rw-r--r--core/modules/action/src/Form/ActionAdminManageForm.php5
-rw-r--r--core/modules/action/src/Form/ActionDeleteForm.php3
-rw-r--r--core/modules/action/src/Plugin/Action/EmailAction.php7
-rw-r--r--core/modules/action/src/Plugin/Action/GotoAction.php5
-rw-r--r--core/modules/action/src/Plugin/Action/MessageAction.php5
-rw-r--r--core/modules/aggregator/src/FeedForm.php7
-rw-r--r--core/modules/aggregator/src/Form/FeedDeleteForm.php3
-rw-r--r--core/modules/aggregator/src/Form/FeedItemsDeleteForm.php3
-rw-r--r--core/modules/aggregator/src/Form/OpmlFeedAdd.php7
-rw-r--r--core/modules/aggregator/src/Form/SettingsForm.php7
-rw-r--r--core/modules/aggregator/src/Plugin/AggregatorPluginSettingsBase.php3
-rw-r--r--core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php9
-rw-r--r--core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php5
-rw-r--r--core/modules/aggregator/src/Plugin/views/field/TitleLink.php3
-rw-r--r--core/modules/aggregator/src/Plugin/views/row/Rss.php3
-rw-r--r--core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/processor/TestProcessor.php5
-rw-r--r--core/modules/aggregator/tests/src/Plugin/AggregatorPluginSettingsBaseTest.php3
-rw-r--r--core/modules/ban/src/Form/BanAdmin.php7
-rw-r--r--core/modules/ban/src/Form/BanDelete.php5
-rw-r--r--core/modules/block/src/BlockBase.php30
-rw-r--r--core/modules/block/src/BlockForm.php29
-rw-r--r--core/modules/block/src/BlockListBuilder.php7
-rw-r--r--core/modules/block/src/BlockPluginInterface.php31
-rw-r--r--core/modules/block/src/Form/BlockDeleteForm.php3
-rw-r--r--core/modules/block/src/Plugin/views/display/Block.php23
-rw-r--r--core/modules/block/src/Tests/BlockInterfaceTest.php3
-rw-r--r--core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php5
-rw-r--r--core/modules/block_content/src/BlockContentForm.php9
-rw-r--r--core/modules/block_content/src/BlockContentTranslationHandler.php3
-rw-r--r--core/modules/block_content/src/BlockContentTypeForm.php7
-rw-r--r--core/modules/block_content/src/Form/BlockContentDeleteForm.php5
-rw-r--r--core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php5
-rw-r--r--core/modules/block_content/src/Plugin/Block/BlockContentBlock.php7
-rw-r--r--core/modules/book/book.module9
-rw-r--r--core/modules/book/src/BookManager.php3
-rw-r--r--core/modules/book/src/BookManagerInterface.php7
-rw-r--r--core/modules/book/src/Form/BookAdminEditForm.php7
-rw-r--r--core/modules/book/src/Form/BookOutlineForm.php9
-rw-r--r--core/modules/book/src/Form/BookRemoveForm.php5
-rw-r--r--core/modules/book/src/Form/BookSettingsForm.php7
-rw-r--r--core/modules/book/src/Plugin/Block/BookNavigationBlock.php9
-rw-r--r--core/modules/ckeditor/src/CKEditorPluginConfigurableInterface.php5
-rw-r--r--core/modules/ckeditor/src/CKEditorPluginManager.php7
-rw-r--r--core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImage.php5
-rw-r--r--core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php5
-rw-r--r--core/modules/ckeditor/src/Plugin/Editor/CKEditor.php5
-rw-r--r--core/modules/ckeditor/tests/modules/src/Plugin/CKEditorPlugin/LlamaContextualAndButton.php3
-rw-r--r--core/modules/color/color.module15
-rw-r--r--core/modules/comment/comment.module5
-rw-r--r--core/modules/comment/src/CommentForm.php19
-rw-r--r--core/modules/comment/src/CommentTypeForm.php5
-rw-r--r--core/modules/comment/src/Form/CommentAdminOverview.php11
-rw-r--r--core/modules/comment/src/Form/CommentTypeDeleteForm.php5
-rw-r--r--core/modules/comment/src/Form/ConfirmDeleteMultiple.php5
-rw-r--r--core/modules/comment/src/Form/DeleteForm.php3
-rw-r--r--core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php5
-rw-r--r--core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php3
-rw-r--r--core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php5
-rw-r--r--core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php5
-rw-r--r--core/modules/comment/src/Plugin/views/field/Comment.php3
-rw-r--r--core/modules/comment/src/Plugin/views/field/EntityLink.php3
-rw-r--r--core/modules/comment/src/Plugin/views/field/Link.php3
-rw-r--r--core/modules/comment/src/Plugin/views/field/LinkEdit.php3
-rw-r--r--core/modules/comment/src/Plugin/views/field/NodeNewComments.php3
-rw-r--r--core/modules/comment/src/Plugin/views/field/Username.php3
-rw-r--r--core/modules/comment/src/Plugin/views/row/CommentRow.php3
-rw-r--r--core/modules/comment/src/Plugin/views/row/Rss.php3
-rw-r--r--core/modules/comment/src/Plugin/views/wizard/Comment.php7
-rw-r--r--core/modules/config/src/Form/ConfigExportForm.php5
-rw-r--r--core/modules/config/src/Form/ConfigImportForm.php7
-rw-r--r--core/modules/config/src/Form/ConfigSingleExportForm.php14
-rw-r--r--core/modules/config/src/Form/ConfigSingleImportForm.php7
-rw-r--r--core/modules/config/src/Form/ConfigSync.php5
-rw-r--r--core/modules/config/tests/config_test/src/ConfigTestForm.php9
-rw-r--r--core/modules/config/tests/config_test/src/Form/ConfigTestDeleteForm.php3
-rw-r--r--core/modules/config_translation/src/Form/ConfigTranslationAddForm.php5
-rw-r--r--core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php5
-rw-r--r--core/modules/config_translation/src/Form/ConfigTranslationEditForm.php5
-rw-r--r--core/modules/config_translation/src/Form/ConfigTranslationFormBase.php9
-rw-r--r--core/modules/config_translation/src/FormElement/DateFormat.php5
-rw-r--r--core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module7
-rw-r--r--core/modules/contact/contact.module9
-rw-r--r--core/modules/contact/src/CategoryForm.php7
-rw-r--r--core/modules/contact/src/Form/CategoryDeleteForm.php3
-rw-r--r--core/modules/contact/src/MessageForm.php11
-rw-r--r--core/modules/contact/src/Plugin/views/field/ContactLink.php3
-rw-r--r--core/modules/content_translation/content_translation.admin.inc7
-rw-r--r--core/modules/content_translation/content_translation.module25
-rw-r--r--core/modules/content_translation/src/ContentTranslationHandler.php15
-rw-r--r--core/modules/content_translation/src/ContentTranslationHandlerInterface.php13
-rw-r--r--core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php5
-rw-r--r--core/modules/content_translation/src/Plugin/views/field/TranslationLink.php3
-rw-r--r--core/modules/contextual/src/Plugin/views/field/ContextualLinks.php3
-rw-r--r--core/modules/datetime/datetime.module37
-rw-r--r--core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php3
-rw-r--r--core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php7
-rw-r--r--core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php3
-rw-r--r--core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php5
-rw-r--r--core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php3
-rw-r--r--core/modules/dblog/dblog.module3
-rw-r--r--core/modules/dblog/src/Form/DblogClearLogConfirmForm.php3
-rw-r--r--core/modules/dblog/src/Form/DblogClearLogForm.php5
-rw-r--r--core/modules/dblog/src/Form/DblogFilterForm.php9
-rw-r--r--core/modules/dblog/src/Plugin/views/field/DblogMessage.php3
-rw-r--r--core/modules/editor/editor.module11
-rw-r--r--core/modules/editor/src/Form/EditorImageDialog.php5
-rw-r--r--core/modules/editor/src/Form/EditorLinkDialog.php5
-rw-r--r--core/modules/editor/src/Plugin/EditorBase.php7
-rw-r--r--core/modules/editor/src/Plugin/EditorPluginInterface.php17
-rw-r--r--core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php3
-rw-r--r--core/modules/entity/src/Entity/EntityFormDisplay.php7
-rw-r--r--core/modules/entity/src/Form/EntityDisplayModeAddForm.php5
-rw-r--r--core/modules/entity/src/Form/EntityDisplayModeDeleteForm.php3
-rw-r--r--core/modules/entity/src/Form/EntityDisplayModeFormBase.php11
-rw-r--r--core/modules/entity_reference/entity_reference.module5
-rw-r--r--core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php9
-rw-r--r--core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php3
-rw-r--r--core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php3
-rw-r--r--core/modules/entity_reference/src/Plugin/Field/FieldType/ConfigurableEntityReferenceFieldItemList.php3
-rw-r--r--core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteTagsWidget.php3
-rw-r--r--core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidget.php3
-rw-r--r--core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php9
-rw-r--r--core/modules/entity_reference/src/Plugin/Type/Selection/SelectionBroken.php3
-rw-r--r--core/modules/entity_reference/src/Plugin/Type/Selection/SelectionInterface.php7
-rw-r--r--core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php3
-rw-r--r--core/modules/entity_reference/src/Plugin/views/row/EntityReference.php3
-rw-r--r--core/modules/entity_reference/src/Plugin/views/style/EntityReference.php3
-rw-r--r--core/modules/field/field.api.php8
-rw-r--r--core/modules/field/field.module3
-rw-r--r--core/modules/field/src/Plugin/views/argument/FieldList.php3
-rw-r--r--core/modules/field/src/Plugin/views/argument/ListString.php3
-rw-r--r--core/modules/field/src/Plugin/views/field/Field.php9
-rw-r--r--core/modules/field/src/Tests/FieldAttachOtherTest.php7
-rw-r--r--core/modules/field/src/Tests/FormTest.php3
-rw-r--r--core/modules/field/tests/modules/field_test/field_test.module3
-rw-r--r--core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php7
-rw-r--r--core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php3
-rw-r--r--core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php3
-rw-r--r--core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php3
-rw-r--r--core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php3
-rw-r--r--core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItem.php5
-rw-r--r--core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidget.php7
-rw-r--r--core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php9
-rw-r--r--core/modules/field_ui/field_ui.api.php4
-rw-r--r--core/modules/field_ui/field_ui.module3
-rw-r--r--core/modules/field_ui/src/DisplayOverview.php7
-rw-r--r--core/modules/field_ui/src/DisplayOverviewBase.php23
-rw-r--r--core/modules/field_ui/src/FieldOverview.php19
-rw-r--r--core/modules/field_ui/src/Form/FieldInstanceConfigDeleteForm.php3
-rw-r--r--core/modules/field_ui/src/Form/FieldInstanceEditForm.php9
-rw-r--r--core/modules/field_ui/src/Form/FieldStorageEditForm.php7
-rw-r--r--core/modules/field_ui/src/FormDisplayOverview.php7
-rw-r--r--core/modules/field_ui/src/OverviewBase.php7
-rw-r--r--core/modules/file/file.module19
-rw-r--r--core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php3
-rw-r--r--core/modules/file/src/Plugin/Field/FieldType/FileItem.php11
-rw-r--r--core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php17
-rw-r--r--core/modules/file/src/Plugin/views/field/Extension.php3
-rw-r--r--core/modules/file/src/Plugin/views/field/File.php3
-rw-r--r--core/modules/file/src/Plugin/views/field/FileMime.php3
-rw-r--r--core/modules/file/src/Plugin/views/field/Uri.php3
-rw-r--r--core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php9
-rw-r--r--core/modules/file/tests/file_test/src/Form/FileTestForm.php7
-rw-r--r--core/modules/filter/src/FilterFormatAddForm.php6
-rw-r--r--core/modules/filter/src/FilterFormatEditForm.php5
-rw-r--r--core/modules/filter/src/FilterFormatFormBase.php9
-rw-r--r--core/modules/filter/src/FilterFormatListBuilder.php6
-rw-r--r--core/modules/filter/src/Form/FilterDisableForm.php3
-rw-r--r--core/modules/filter/src/Plugin/Filter/FilterHtml.php3
-rw-r--r--core/modules/filter/src/Plugin/Filter/FilterUrl.php3
-rw-r--r--core/modules/filter/src/Plugin/FilterBase.php3
-rw-r--r--core/modules/filter/src/Plugin/FilterInterface.php5
-rw-r--r--core/modules/filter/tests/filter_test/src/Form/FilterTestFormatForm.php5
-rw-r--r--core/modules/forum/forum.module9
-rw-r--r--core/modules/forum/src/Form/ContainerForm.php6
-rw-r--r--core/modules/forum/src/Form/DeleteForm.php5
-rw-r--r--core/modules/forum/src/Form/ForumForm.php9
-rw-r--r--core/modules/forum/src/Form/Overview.php3
-rw-r--r--core/modules/forum/src/ForumSettingsForm.php5
-rw-r--r--core/modules/forum/src/Plugin/Block/ForumBlockBase.php9
-rw-r--r--core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php3
-rw-r--r--core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php5
-rw-r--r--core/modules/image/src/ConfigurableImageEffectBase.php6
-rw-r--r--core/modules/image/src/Form/ImageEffectAddForm.php3
-rw-r--r--core/modules/image/src/Form/ImageEffectDeleteForm.php5
-rw-r--r--core/modules/image/src/Form/ImageEffectEditForm.php3
-rw-r--r--core/modules/image/src/Form/ImageEffectFormBase.php25
-rw-r--r--core/modules/image/src/Form/ImageStyleAddForm.php6
-rw-r--r--core/modules/image/src/Form/ImageStyleDeleteForm.php5
-rw-r--r--core/modules/image/src/Form/ImageStyleEditForm.php13
-rw-r--r--core/modules/image/src/Form/ImageStyleFlushForm.php3
-rw-r--r--core/modules/image/src/Form/ImageStyleFormBase.php5
-rw-r--r--core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php3
-rw-r--r--core/modules/image/src/Plugin/Field/FieldType/ImageItem.php11
-rw-r--r--core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php11
-rw-r--r--core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php3
-rw-r--r--core/modules/image/src/Plugin/ImageEffect/ResizeImageEffect.php5
-rw-r--r--core/modules/image/src/Plugin/ImageEffect/RotateImageEffect.php7
-rw-r--r--core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php7
-rw-r--r--core/modules/language/language.module9
-rw-r--r--core/modules/language/src/Form/ContentLanguageSettingsForm.php5
-rw-r--r--core/modules/language/src/Form/LanguageAddForm.php11
-rw-r--r--core/modules/language/src/Form/LanguageDeleteForm.php5
-rw-r--r--core/modules/language/src/Form/LanguageEditForm.php7
-rw-r--r--core/modules/language/src/Form/LanguageFormBase.php3
-rw-r--r--core/modules/language/src/Form/NegotiationBrowserDeleteForm.php5
-rw-r--r--core/modules/language/src/Form/NegotiationBrowserForm.php7
-rw-r--r--core/modules/language/src/Form/NegotiationConfigureForm.php5
-rw-r--r--core/modules/language/src/Form/NegotiationSelectedForm.php9
-rw-r--r--core/modules/language/src/Form/NegotiationSessionForm.php9
-rw-r--r--core/modules/language/src/Form/NegotiationUrlForm.php11
-rw-r--r--core/modules/language/src/LanguageListBuilder.php5
-rw-r--r--core/modules/language/src/Plugin/Condition/Language.php5
-rw-r--r--core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php5
-rw-r--r--core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php5
-rw-r--r--core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php3
-rw-r--r--core/modules/link/src/Plugin/Field/FieldType/LinkItem.php3
-rw-r--r--core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php9
-rw-r--r--core/modules/locale/locale.module7
-rw-r--r--core/modules/locale/src/Form/ExportForm.php5
-rw-r--r--core/modules/locale/src/Form/ImportForm.php7
-rw-r--r--core/modules/locale/src/Form/LocaleSettingsForm.php11
-rw-r--r--core/modules/locale/src/Form/TranslateEditForm.php7
-rw-r--r--core/modules/locale/src/Form/TranslateFilterForm.php8
-rw-r--r--core/modules/locale/src/Form/TranslationStatusForm.php7
-rw-r--r--core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php3
-rw-r--r--core/modules/menu_link_content/src/Form/MenuLinkContentForm.php25
-rw-r--r--core/modules/menu_ui/menu_ui.module3
-rw-r--r--core/modules/menu_ui/src/Form/MenuDeleteForm.php3
-rw-r--r--core/modules/menu_ui/src/Form/MenuLinkEditForm.php7
-rw-r--r--core/modules/menu_ui/src/Form/MenuLinkResetForm.php5
-rw-r--r--core/modules/menu_ui/src/MenuForm.php11
-rw-r--r--core/modules/menu_ui/src/MenuSettingsForm.php9
-rw-r--r--core/modules/node/node.api.php8
-rw-r--r--core/modules/node/node.module9
-rw-r--r--core/modules/node/node.pages.inc3
-rw-r--r--core/modules/node/src/Form/DeleteMultiple.php5
-rw-r--r--core/modules/node/src/Form/NodeDeleteForm.php3
-rw-r--r--core/modules/node/src/Form/NodeRevisionDeleteForm.php5
-rw-r--r--core/modules/node/src/Form/NodeRevisionRevertForm.php5
-rw-r--r--core/modules/node/src/Form/NodeTypeDeleteConfirm.php5
-rw-r--r--core/modules/node/src/Form/RebuildPermissionsForm.php3
-rw-r--r--core/modules/node/src/NodeForm.php36
-rw-r--r--core/modules/node/src/NodeTranslationHandler.php5
-rw-r--r--core/modules/node/src/NodeTypeForm.php9
-rw-r--r--core/modules/node/src/Plugin/Action/AssignOwnerNode.php7
-rw-r--r--core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php5
-rw-r--r--core/modules/node/src/Plugin/Block/SyndicateBlock.php3
-rw-r--r--core/modules/node/src/Plugin/Condition/NodeType.php5
-rw-r--r--core/modules/node/src/Plugin/Search/NodeSearch.php7
-rw-r--r--core/modules/node/src/Plugin/views/field/Language.php3
-rw-r--r--core/modules/node/src/Plugin/views/field/Link.php3
-rw-r--r--core/modules/node/src/Plugin/views/field/Node.php3
-rw-r--r--core/modules/node/src/Plugin/views/field/Path.php3
-rw-r--r--core/modules/node/src/Plugin/views/field/Revision.php3
-rw-r--r--core/modules/node/src/Plugin/views/field/Type.php3
-rw-r--r--core/modules/node/src/Plugin/views/filter/Access.php3
-rw-r--r--core/modules/node/src/Plugin/views/filter/Status.php3
-rw-r--r--core/modules/node/src/Plugin/views/row/NodeRow.php3
-rw-r--r--core/modules/node/src/Plugin/views/row/Rss.php3
-rw-r--r--core/modules/node/src/Plugin/views/wizard/Node.php13
-rw-r--r--core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php7
-rw-r--r--core/modules/options/src/Plugin/Field/FieldWidget/ButtonsWidget.php3
-rw-r--r--core/modules/options/src/Plugin/Field/FieldWidget/OptionsWidgetBase.php7
-rw-r--r--core/modules/options/src/Plugin/Field/FieldWidget/SelectWidget.php3
-rw-r--r--core/modules/path/src/Form/DeleteForm.php9
-rw-r--r--core/modules/path/src/Form/EditForm.php5
-rw-r--r--core/modules/path/src/Form/PathFilterForm.php7
-rw-r--r--core/modules/path/src/Form/PathFormBase.php7
-rw-r--r--core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php9
-rw-r--r--core/modules/quickedit/src/Form/QuickEditFieldForm.php17
-rw-r--r--core/modules/quickedit/src/QuickEditController.php5
-rw-r--r--core/modules/responsive_image/src/Form/ResponsiveImageMappingDeleteForm.php3
-rw-r--r--core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php3
-rw-r--r--core/modules/responsive_image/src/ResponsiveImageMappingForm.php11
-rw-r--r--core/modules/rest/src/Plugin/views/row/DataFieldRow.php7
-rw-r--r--core/modules/rest/src/Plugin/views/style/Serializer.php5
-rw-r--r--core/modules/search/search.module3
-rw-r--r--core/modules/search/src/Form/ReindexConfirm.php5
-rw-r--r--core/modules/search/src/Form/SearchBlockForm.php5
-rw-r--r--core/modules/search/src/Form/SearchPageAddForm.php8
-rw-r--r--core/modules/search/src/Form/SearchPageDeleteForm.php3
-rw-r--r--core/modules/search/src/Form/SearchPageEditForm.php6
-rw-r--r--core/modules/search/src/Form/SearchPageForm.php7
-rw-r--r--core/modules/search/src/Form/SearchPageFormBase.php11
-rw-r--r--core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php3
-rw-r--r--core/modules/search/src/Plugin/SearchInterface.php11
-rw-r--r--core/modules/search/src/Plugin/SearchPluginBase.php3
-rw-r--r--core/modules/search/src/Plugin/views/filter/Search.php7
-rw-r--r--core/modules/search/src/Plugin/views/row/SearchRow.php3
-rw-r--r--core/modules/search/src/SearchPageListBuilder.php13
-rw-r--r--core/modules/search/tests/modules/search_embedded_form/src/Form/SearchEmbeddedForm.php5
-rw-r--r--core/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php5
-rw-r--r--core/modules/shortcut/src/Form/SetCustomize.php7
-rw-r--r--core/modules/shortcut/src/Form/ShortcutDeleteForm.php3
-rw-r--r--core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php5
-rw-r--r--core/modules/shortcut/src/Form/SwitchShortcutSet.php7
-rw-r--r--core/modules/shortcut/src/ShortcutForm.php9
-rw-r--r--core/modules/shortcut/src/ShortcutSetForm.php7
-rw-r--r--core/modules/simpletest/src/Form/SimpletestResultsForm.php8
-rw-r--r--core/modules/simpletest/src/Form/SimpletestSettingsForm.php7
-rw-r--r--core/modules/simpletest/src/Form/SimpletestTestForm.php5
-rw-r--r--core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php9
-rw-r--r--core/modules/statistics/src/StatisticsSettingsForm.php9
-rw-r--r--core/modules/syslog/syslog.module5
-rw-r--r--core/modules/system/core.api.php8
-rw-r--r--core/modules/system/entity.api.php12
-rw-r--r--core/modules/system/src/Controller/FormAjaxController.php3
-rw-r--r--core/modules/system/src/Form/CronForm.php7
-rw-r--r--core/modules/system/src/Form/DateFormatAddForm.php6
-rw-r--r--core/modules/system/src/Form/DateFormatDeleteForm.php3
-rw-r--r--core/modules/system/src/Form/DateFormatEditForm.php8
-rw-r--r--core/modules/system/src/Form/DateFormatFormBase.php17
-rw-r--r--core/modules/system/src/Form/FileSystemForm.php5
-rw-r--r--core/modules/system/src/Form/ImageToolkitForm.php5
-rw-r--r--core/modules/system/src/Form/LoggingForm.php5
-rw-r--r--core/modules/system/src/Form/ModulesListConfirmForm.php5
-rw-r--r--core/modules/system/src/Form/ModulesListForm.php11
-rw-r--r--core/modules/system/src/Form/ModulesUninstallConfirmForm.php5
-rw-r--r--core/modules/system/src/Form/ModulesUninstallForm.php7
-rw-r--r--core/modules/system/src/Form/PerformanceForm.php7
-rw-r--r--core/modules/system/src/Form/RegionalForm.php5
-rw-r--r--core/modules/system/src/Form/RssFeedsForm.php5
-rw-r--r--core/modules/system/src/Form/SiteInformationForm.php7
-rw-r--r--core/modules/system/src/Form/SiteMaintenanceModeForm.php5
-rw-r--r--core/modules/system/src/Form/ThemeAdminForm.php5
-rw-r--r--core/modules/system/src/Form/ThemeSettingsForm.php7
-rw-r--r--core/modules/system/src/Plugin/Block/SystemBrandingBlock.php5
-rw-r--r--core/modules/system/src/Plugin/Block/SystemMainBlock.php3
-rw-r--r--core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php4
-rw-r--r--core/modules/system/src/Plugin/Condition/CurrentThemeCondition.php5
-rw-r--r--core/modules/system/src/Plugin/Condition/RequestPath.php5
-rw-r--r--core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php3
-rw-r--r--core/modules/system/src/Plugin/views/field/BulkForm.php19
-rw-r--r--core/modules/system/src/Tests/Form/ElementsTableSelectTest.php3
-rw-r--r--core/modules/system/src/Tests/Form/FormCacheTest.php11
-rw-r--r--core/modules/system/src/Tests/Form/FormDefaultHandlersTest.php14
-rw-r--r--core/modules/system/src/Tests/Form/FormTest.php5
-rw-r--r--core/modules/system/src/Tests/Form/ProgrammaticTest.php4
-rw-r--r--core/modules/system/src/Tests/Form/StubForm.php5
-rw-r--r--core/modules/system/src/Tests/Form/TriggeringElementProgrammedUnitTest.php9
-rw-r--r--core/modules/system/src/Tests/System/SystemConfigFormTestBase.php6
-rw-r--r--core/modules/system/system.api.php20
-rw-r--r--core/modules/system/system.module7
-rw-r--r--core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module3
-rw-r--r--core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestCommandsForm.php5
-rw-r--r--core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestLazyLoadForm.php5
-rw-r--r--core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php5
-rw-r--r--core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php5
-rw-r--r--core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php11
-rw-r--r--core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestForm.php7
-rw-r--r--core/modules/system/tests/modules/batch_test/batch_test.module3
-rw-r--r--core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php5
-rw-r--r--core/modules/system/tests/modules/batch_test/src/Form/BatchTestChainedForm.php13
-rw-r--r--core/modules/system/tests/modules/batch_test/src/Form/BatchTestMockForm.php5
-rw-r--r--core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php5
-rw-r--r--core/modules/system/tests/modules/batch_test/src/Form/BatchTestSimpleForm.php5
-rw-r--r--core/modules/system/tests/modules/condition_test/src/FormController.php12
-rw-r--r--core/modules/system/tests/modules/database_test/src/Form/DatabaseTestForm.php5
-rw-r--r--core/modules/system/tests/modules/entity_test/entity_test.module3
-rw-r--r--core/modules/system/tests/modules/entity_test/src/EntityTestDeleteForm.php3
-rw-r--r--core/modules/system/tests/modules/entity_test/src/EntityTestForm.php13
-rw-r--r--core/modules/system/tests/modules/form_test/form_test.module16
-rw-r--r--core/modules/system/tests/modules/form_test/src/Callbacks.php4
-rw-r--r--core/modules/system/tests/modules/form_test/src/ConfirmFormTestForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestAlterForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestButtonClassForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxTypeJugglingForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxesRadiosForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxesZeroForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestClickedButtonForm.php7
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestColorForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestEmailForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestEmptySelectForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestFormStateDatabaseForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestFormStateValuesCleanAdvancedForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestFormStateValuesCleanForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestGroupContainerForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestGroupDetailsForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestGroupVerticalTabsForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestInputForgeryForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestLabelForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestLanguageSelectForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php9
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestNumberForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestPatternForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestPlaceholderForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestProgrammaticForm.php7
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestRangeForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestRangeInvalidForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestRebuildPreserveValuesForm.php7
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestRedirectForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestRequiredAttributeForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestSelectForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestStatePersistForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestStorageForm.php9
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectColspanForm.php6
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectEmptyForm.php6
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php4
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectJsSelectForm.php6
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectMultipleFalseForm.php6
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectMultipleTrueForm.php6
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestUrlForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestValidateForm.php7
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestValidateRequiredForm.php7
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestValidateRequiredNoTitleForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/FormTestVerticalTabsForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/Form/RedirectBlockForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/FormTestArgumentsObject.php7
-rw-r--r--core/modules/system/tests/modules/form_test/src/FormTestAutocompleteForm.php5
-rw-r--r--core/modules/system/tests/modules/form_test/src/FormTestControllerObject.php7
-rw-r--r--core/modules/system/tests/modules/form_test/src/FormTestObject.php7
-rw-r--r--core/modules/system/tests/modules/form_test/src/FormTestServiceObject.php7
-rw-r--r--core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php3
-rw-r--r--core/modules/system/tests/modules/session_test/src/Form/SessionTestForm.php5
-rw-r--r--core/modules/system/theme.api.php4
-rw-r--r--core/modules/taxonomy/src/Form/OverviewTerms.php15
-rw-r--r--core/modules/taxonomy/src/Form/TermDeleteForm.php3
-rw-r--r--core/modules/taxonomy/src/Form/VocabularyDeleteForm.php3
-rw-r--r--core/modules/taxonomy/src/Form/VocabularyResetForm.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceFieldItemList.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php5
-rw-r--r--core/modules/taxonomy/src/Plugin/Field/FieldWidget/TaxonomyAutocompleteWidget.php7
-rw-r--r--core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php5
-rw-r--r--core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/views/field/Taxonomy.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php13
-rw-r--r--core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php4
-rw-r--r--core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php3
-rw-r--r--core/modules/taxonomy/src/TermForm.php9
-rw-r--r--core/modules/taxonomy/src/TermTranslationHandler.php5
-rw-r--r--core/modules/taxonomy/src/VocabularyForm.php9
-rw-r--r--core/modules/taxonomy/src/VocabularyListBuilder.php5
-rw-r--r--core/modules/taxonomy/taxonomy.module3
-rw-r--r--core/modules/telephone/src/Plugin/Field/FieldFormatter/TelephoneLinkFormatter.php3
-rw-r--r--core/modules/telephone/src/Plugin/Field/FieldWidget/TelephoneDefaultWidget.php5
-rw-r--r--core/modules/text/src/Plugin/Field/FieldFormatter/TextTrimmedFormatter.php3
-rw-r--r--core/modules/text/src/Plugin/Field/FieldType/TextItem.php5
-rw-r--r--core/modules/text/src/Plugin/Field/FieldType/TextLongItem.php3
-rw-r--r--core/modules/text/src/Plugin/Field/FieldType/TextWithSummaryItem.php3
-rw-r--r--core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php5
-rw-r--r--core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php7
-rw-r--r--core/modules/text/src/Plugin/Field/FieldWidget/TextfieldWidget.php5
-rw-r--r--core/modules/update/src/Form/UpdateManagerInstall.php7
-rw-r--r--core/modules/update/src/Form/UpdateManagerUpdate.php7
-rw-r--r--core/modules/update/src/Form/UpdateReady.php5
-rw-r--r--core/modules/update/src/UpdateSettingsForm.php11
-rw-r--r--core/modules/update/update.module3
-rw-r--r--core/modules/user/src/AccountForm.php9
-rw-r--r--core/modules/user/src/AccountSettingsForm.php9
-rw-r--r--core/modules/user/src/Form/UserCancelForm.php5
-rw-r--r--core/modules/user/src/Form/UserLoginForm.php11
-rw-r--r--core/modules/user/src/Form/UserMultipleCancelConfirm.php5
-rw-r--r--core/modules/user/src/Form/UserPasswordForm.php7
-rw-r--r--core/modules/user/src/Form/UserPasswordResetForm.php9
-rw-r--r--core/modules/user/src/Form/UserPermissionsForm.php5
-rw-r--r--core/modules/user/src/Form/UserPermissionsRoleSpecificForm.php3
-rw-r--r--core/modules/user/src/Form/UserRoleDelete.php3
-rw-r--r--core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php5
-rw-r--r--core/modules/user/src/Plugin/Condition/UserRole.php5
-rw-r--r--core/modules/user/src/Plugin/views/access/Permission.php3
-rw-r--r--core/modules/user/src/Plugin/views/access/Role.php7
-rw-r--r--core/modules/user/src/Plugin/views/argument_default/User.php3
-rw-r--r--core/modules/user/src/Plugin/views/argument_validator/User.php5
-rw-r--r--core/modules/user/src/Plugin/views/argument_validator/UserName.php4
-rw-r--r--core/modules/user/src/Plugin/views/field/Link.php3
-rw-r--r--core/modules/user/src/Plugin/views/field/Mail.php3
-rw-r--r--core/modules/user/src/Plugin/views/field/Name.php3
-rw-r--r--core/modules/user/src/Plugin/views/field/User.php3
-rw-r--r--core/modules/user/src/Plugin/views/field/UserBulkForm.php3
-rw-r--r--core/modules/user/src/Plugin/views/field/UserData.php3
-rw-r--r--core/modules/user/src/Plugin/views/filter/Name.php11
-rw-r--r--core/modules/user/src/ProfileForm.php7
-rw-r--r--core/modules/user/src/ProfileTranslationHandler.php5
-rw-r--r--core/modules/user/src/RegisterForm.php11
-rw-r--r--core/modules/user/src/RoleForm.php5
-rw-r--r--core/modules/user/src/RoleListBuilder.php3
-rw-r--r--core/modules/user/src/Tests/UserAccountFormFieldsTest.php3
-rw-r--r--core/modules/user/src/Tests/Views/ArgumentValidateTest.php4
-rw-r--r--core/modules/user/tests/modules/user_form_test/src/Form/TestCurrentPassword.php5
-rw-r--r--core/modules/user/user.module5
-rw-r--r--core/modules/views/includes/ajax.inc17
-rw-r--r--core/modules/views/src/Form/ViewsExposedForm.php7
-rw-r--r--core/modules/views/src/Form/ViewsForm.php11
-rw-r--r--core/modules/views/src/Form/ViewsFormMainForm.php7
-rw-r--r--core/modules/views/src/ManyToOneHelper.php3
-rw-r--r--core/modules/views/src/Plugin/Block/ViewsBlock.php7
-rw-r--r--core/modules/views/src/Plugin/Block/ViewsBlockBase.php5
-rw-r--r--core/modules/views/src/Plugin/Menu/Form/ViewsMenuLinkForm.php5
-rw-r--r--core/modules/views/src/Plugin/entity_reference/selection/ViewsSelection.php5
-rw-r--r--core/modules/views/src/Plugin/views/BrokenHandlerTrait.php4
-rw-r--r--core/modules/views/src/Plugin/views/HandlerBase.php33
-rw-r--r--core/modules/views/src/Plugin/views/PluginBase.php13
-rw-r--r--core/modules/views/src/Plugin/views/area/AreaPluginBase.php3
-rw-r--r--core/modules/views/src/Plugin/views/area/Entity.php3
-rw-r--r--core/modules/views/src/Plugin/views/area/HTTPStatusCode.php3
-rw-r--r--core/modules/views/src/Plugin/views/area/Result.php3
-rw-r--r--core/modules/views/src/Plugin/views/area/Text.php6
-rw-r--r--core/modules/views/src/Plugin/views/area/TextCustom.php4
-rw-r--r--core/modules/views/src/Plugin/views/area/Title.php3
-rw-r--r--core/modules/views/src/Plugin/views/area/TokenizeAreaPluginBase.php6
-rw-r--r--core/modules/views/src/Plugin/views/area/View.php3
-rw-r--r--core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php11
-rw-r--r--core/modules/views/src/Plugin/views/argument/Date.php3
-rw-r--r--core/modules/views/src/Plugin/views/argument/ManyToOne.php3
-rw-r--r--core/modules/views/src/Plugin/views/argument/Null.php4
-rw-r--r--core/modules/views/src/Plugin/views/argument/Numeric.php4
-rw-r--r--core/modules/views/src/Plugin/views/argument/String.php3
-rw-r--r--core/modules/views/src/Plugin/views/argument_default/ArgumentDefaultPluginBase.php7
-rw-r--r--core/modules/views/src/Plugin/views/argument_default/Fixed.php4
-rw-r--r--core/modules/views/src/Plugin/views/argument_default/QueryParameter.php4
-rw-r--r--core/modules/views/src/Plugin/views/argument_default/Raw.php3
-rw-r--r--core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php7
-rw-r--r--core/modules/views/src/Plugin/views/argument_validator/Entity.php5
-rw-r--r--core/modules/views/src/Plugin/views/cache/Time.php6
-rw-r--r--core/modules/views/src/Plugin/views/display/Attachment.php5
-rw-r--r--core/modules/views/src/Plugin/views/display/DisplayPluginBase.php9
-rw-r--r--core/modules/views/src/Plugin/views/display/Feed.php5
-rw-r--r--core/modules/views/src/Plugin/views/display/Page.php7
-rw-r--r--core/modules/views/src/Plugin/views/display/PathPluginBase.php7
-rw-r--r--core/modules/views/src/Plugin/views/display_extender/DisplayExtenderPluginBase.php7
-rw-r--r--core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php18
-rw-r--r--core/modules/views/src/Plugin/views/exposed_form/InputRequired.php5
-rw-r--r--core/modules/views/src/Plugin/views/field/Boolean.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/Counter.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/Custom.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/Date.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/EntityLabel.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/FieldPluginBase.php5
-rw-r--r--core/modules/views/src/Plugin/views/field/FileSize.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/LanguageField.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/Links.php4
-rw-r--r--core/modules/views/src/Plugin/views/field/MachineName.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/Numeric.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/PrerenderList.php4
-rw-r--r--core/modules/views/src/Plugin/views/field/Serialized.php5
-rw-r--r--core/modules/views/src/Plugin/views/field/TimeInterval.php3
-rw-r--r--core/modules/views/src/Plugin/views/field/Url.php3
-rw-r--r--core/modules/views/src/Plugin/views/filter/BooleanOperator.php5
-rw-r--r--core/modules/views/src/Plugin/views/filter/Combine.php4
-rw-r--r--core/modules/views/src/Plugin/views/filter/Date.php12
-rw-r--r--core/modules/views/src/Plugin/views/filter/Equality.php4
-rw-r--r--core/modules/views/src/Plugin/views/filter/FilterPluginBase.php49
-rw-r--r--core/modules/views/src/Plugin/views/filter/InOperator.php7
-rw-r--r--core/modules/views/src/Plugin/views/filter/ManyToOne.php3
-rw-r--r--core/modules/views/src/Plugin/views/filter/Numeric.php3
-rw-r--r--core/modules/views/src/Plugin/views/filter/String.php3
-rw-r--r--core/modules/views/src/Plugin/views/pager/Full.php4
-rw-r--r--core/modules/views/src/Plugin/views/pager/None.php3
-rw-r--r--core/modules/views/src/Plugin/views/pager/PagerPluginBase.php11
-rw-r--r--core/modules/views/src/Plugin/views/pager/Some.php4
-rw-r--r--core/modules/views/src/Plugin/views/pager/SqlBase.php10
-rw-r--r--core/modules/views/src/Plugin/views/query/QueryPluginBase.php5
-rw-r--r--core/modules/views/src/Plugin/views/query/Sql.php5
-rw-r--r--core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php5
-rw-r--r--core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php3
-rw-r--r--core/modules/views/src/Plugin/views/row/EntityRow.php3
-rw-r--r--core/modules/views/src/Plugin/views/row/Fields.php6
-rw-r--r--core/modules/views/src/Plugin/views/row/OpmlFields.php4
-rw-r--r--core/modules/views/src/Plugin/views/row/RowPluginBase.php7
-rw-r--r--core/modules/views/src/Plugin/views/row/RssFields.php4
-rw-r--r--core/modules/views/src/Plugin/views/sort/Date.php4
-rw-r--r--core/modules/views/src/Plugin/views/sort/Random.php4
-rw-r--r--core/modules/views/src/Plugin/views/sort/SortPluginBase.php17
-rw-r--r--core/modules/views/src/Plugin/views/style/DefaultSummary.php3
-rw-r--r--core/modules/views/src/Plugin/views/style/Grid.php4
-rw-r--r--core/modules/views/src/Plugin/views/style/HtmlList.php4
-rw-r--r--core/modules/views/src/Plugin/views/style/Mapping.php4
-rw-r--r--core/modules/views/src/Plugin/views/style/Rss.php3
-rw-r--r--core/modules/views/src/Plugin/views/style/StylePluginBase.php17
-rw-r--r--core/modules/views/src/Plugin/views/style/Table.php5
-rw-r--r--core/modules/views/src/Plugin/views/style/UnformattedSummary.php4
-rw-r--r--core/modules/views/src/Plugin/views/wizard/WizardInterface.php14
-rw-r--r--core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php49
-rw-r--r--core/modules/views/src/Tests/Handler/AreaEntityTest.php3
-rw-r--r--core/modules/views/src/Tests/Plugin/RowEntityTest.php3
-rw-r--r--core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php3
-rw-r--r--core/modules/views/tests/modules/views_test_data/src/Form/ViewsTestDataElementForm.php5
-rw-r--r--core/modules/views/tests/modules/views_test_data/src/Plugin/views/area/TestExample.php3
-rw-r--r--core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php7
-rw-r--r--core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php5
-rw-r--r--core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php3
-rw-r--r--core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php3
-rw-r--r--core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php3
-rw-r--r--core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php3
-rw-r--r--core/modules/views/views.module5
-rw-r--r--core/modules/views_ui/admin.inc13
-rw-r--r--core/modules/views_ui/src/Form/AdvancedSettingsForm.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/AddHandler.php3
-rw-r--r--core/modules/views_ui/src/Form/Ajax/Analyze.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ConfigHandler.php9
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php7
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/Display.php13
-rw-r--r--core/modules/views_ui/src/Form/Ajax/EditDetails.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/Rearrange.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php10
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ViewsFormInterface.php4
-rw-r--r--core/modules/views_ui/src/Form/BasicSettingsForm.php5
-rw-r--r--core/modules/views_ui/src/Form/BreakLockForm.php5
-rw-r--r--core/modules/views_ui/src/ViewAddForm.php15
-rw-r--r--core/modules/views_ui/src/ViewDeleteForm.php5
-rw-r--r--core/modules/views_ui/src/ViewDuplicateForm.php8
-rw-r--r--core/modules/views_ui/src/ViewEditForm.php31
-rw-r--r--core/modules/views_ui/src/ViewFormBase.php5
-rw-r--r--core/modules/views_ui/src/ViewPreviewForm.php7
-rw-r--r--core/modules/views_ui/src/ViewUI.php9
-rw-r--r--core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Entity/EntityFormBuilderTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php15
-rw-r--r--core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php56
-rw-r--r--core/tests/Drupal/Tests/Core/Form/FormStateTest.php162
-rw-r--r--core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php138
-rw-r--r--core/tests/Drupal/Tests/Core/Form/FormTestBase.php7
-rw-r--r--core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php178
-rw-r--r--core/themes/seven/seven.theme5
688 files changed, 4247 insertions, 2743 deletions
diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc
index 7ab2059..d779bd9 100644
--- a/core/includes/ajax.inc
+++ b/core/includes/ajax.inc
@@ -5,6 +5,8 @@
* Functions for use with Drupal's Ajax framework.
*/
+use Drupal\Core\Form\FormStateInterface;
+
/**
* @defgroup ajax Ajax framework
* @{
@@ -64,7 +66,7 @@
* return \Drupal::formBuilder()->getForm('ajax_example_simplest');
* }
*
- * function ajax_example_simplest($form, &$form_state) {
+ * function ajax_example_simplest($form, FormStateInterface $form_state) {
* $form = array();
* $form['changethis'] = array(
* '#type' => 'select',
@@ -236,7 +238,7 @@
*
* @see ajax_pre_render_element()
*/
-function ajax_process_form($element, &$form_state) {
+function ajax_process_form($element, FormStateInterface $form_state) {
$element = ajax_pre_render_element($element);
if (!empty($element['#ajax_processed'])) {
$form_state['cache'] = TRUE;
diff --git a/core/includes/batch.inc b/core/includes/batch.inc
index 02089bb..81f0654 100644
--- a/core/includes/batch.inc
+++ b/core/includes/batch.inc
@@ -17,6 +17,7 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Timer;
use Drupal\Core\Batch\Percentage;
+use Drupal\Core\Form\FormState;
use Drupal\Core\Page\DefaultHtmlPageRenderer;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -442,6 +443,9 @@ function _batch_finished() {
}
// Determine the target path to redirect to.
+ if (!isset($_batch['form_state'])) {
+ $_batch['form_state'] = new FormState();
+ }
if (!isset($_batch['form_state']['redirect'])) {
if (isset($_batch['redirect'])) {
$_batch['form_state']['redirect'] = $_batch['redirect'];
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 7d3107f..7131a7b 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -12,6 +12,7 @@ use Drupal\Component\Utility\String;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Database\Database;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\OptGroup;
use Drupal\Core\Render\Element;
use Drupal\Core\Template\Attribute;
@@ -26,7 +27,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
*
* @see \Drupal\Core\Form\FormBuilderInterface::getCache().
*/
-function form_get_cache($form_build_id, &$form_state) {
+function form_get_cache($form_build_id, FormStateInterface $form_state) {
return \Drupal::formBuilder()->getCache($form_build_id, $form_state);
}
@@ -73,7 +74,7 @@ function form_set_cache($form_build_id, $form, $form_state) {
*
* @see module_load_include()
*/
-function form_load_include(&$form_state, $type, $module, $name = NULL) {
+function form_load_include(FormStateInterface $form_state, $type, $module, $name = NULL) {
if (!isset($name)) {
$name = $module;
}
@@ -99,7 +100,7 @@ function form_load_include(&$form_state, $type, $module, $name = NULL) {
*
* @see \Drupal\Core\Form\FormBuilderInterface::submitForm().
*/
-function drupal_form_submit($form_arg, &$form_state) {
+function drupal_form_submit($form_arg, FormStateInterface $form_state) {
\Drupal::formBuilder()->submitForm($form_arg, $form_state);
}
@@ -111,7 +112,7 @@ function drupal_form_submit($form_arg, &$form_state) {
*
* @see \Drupal\Core\Form\FormBuilderInterface::retrieveForm().
*/
-function drupal_retrieve_form($form_id, &$form_state) {
+function drupal_retrieve_form($form_id, FormStateInterface $form_state) {
return \Drupal::formBuilder()->retrieveForm($form_id, $form_state);
}
@@ -123,7 +124,7 @@ function drupal_retrieve_form($form_id, &$form_state) {
*
* @see \Drupal\Core\Form\FormBuilderInterface::processForm().
*/
-function drupal_process_form($form_id, &$form, &$form_state) {
+function drupal_process_form($form_id, &$form, FormStateInterface $form_state) {
\Drupal::formBuilder()->processForm($form_id, $form, $form_state);
}
@@ -149,7 +150,7 @@ function drupal_redirect_form($form_state) {
* @see \Drupal\Core\Form\FormSubmitterInterface::executeSubmitHandlers()
* @see \Drupal\Core\Form\FormValidatorInterface::executeValidateHandlers()
*/
-function form_execute_handlers($type, &$form, &$form_state) {
+function form_execute_handlers($type, &$form, FormStateInterface $form_state) {
if ($type == 'submit') {
\Drupal::service('form_submitter')->executeSubmitHandlers($form, $form_state);
}
@@ -166,7 +167,7 @@ function form_execute_handlers($type, &$form, &$form_state) {
*
* @see \Drupal\Core\Form\FormErrorInterface::setErrorByName().
*/
-function form_set_error($name, array &$form_state, $message = '') {
+function form_set_error($name, FormStateInterface $form_state, $message = '') {
\Drupal::formBuilder()->setErrorByName($name, $form_state, $message);
}
@@ -178,7 +179,7 @@ function form_set_error($name, array &$form_state, $message = '') {
*
* @see \Drupal\Core\Form\FormErrorInterface::getErrors()
*/
-function form_get_errors(array &$form_state) {
+function form_get_errors(FormStateInterface $form_state) {
return \Drupal::formBuilder()->getErrors($form_state);
}
@@ -190,7 +191,7 @@ function form_get_errors(array &$form_state) {
*
* @see \Drupal\Core\Form\FormErrorInterface::getError().
*/
-function form_get_error($element, array &$form_state) {
+function form_get_error($element, FormStateInterface $form_state) {
return \Drupal::formBuilder()->getError($element, $form_state);
}
@@ -202,7 +203,7 @@ function form_get_error($element, array &$form_state) {
*
* @see \Drupal\Core\Form\FormErrorInterface::setError().
*/
-function form_error(&$element, array &$form_state, $message = '') {
+function form_error(&$element, FormStateInterface $form_state, $message = '') {
\Drupal::formBuilder()->setError($element, $form_state, $message);
}
@@ -214,7 +215,7 @@ function form_error(&$element, array &$form_state, $message = '') {
*
* @see \Drupal\Core\Form\FormBuilderInterface::doBuildForm().
*/
-function form_builder($form_id, &$element, &$form_state) {
+function form_builder($form_id, &$element, FormStateInterface $form_state) {
return \Drupal::formBuilder()->doBuildForm($form_id, $element, $form_state);
}
@@ -233,10 +234,9 @@ function form_builder($form_id, &$element, &$form_state) {
* - op
*
* @param $form_state
- * A keyed array containing the current state of the form, including
- * submitted form values; altered by reference.
+ * The current state of the form, including submitted form values.
*/
-function form_state_values_clean(&$form_state) {
+function form_state_values_clean(FormStateInterface $form_state) {
// Remove internal Form API values.
unset($form_state['values']['form_id'], $form_state['values']['form_token'], $form_state['values']['form_build_id'], $form_state['values']['op']);
@@ -282,7 +282,7 @@ function form_state_values_clean(&$form_state) {
* The incoming input to populate the form element. If this is FALSE,
* the element's default value should be returned.
* @param $form_state
- * A keyed array containing the current state of the form.
+ * The current state of the form.
*
* @return
* The data that will appear in the $form_state['values'] collection
@@ -619,7 +619,7 @@ function form_type_token_value($element, $input = FALSE) {
*
* @see \Drupal\Core\Form\FormBuilderInterface::setValue().
*/
-function form_set_value($element, $value, &$form_state) {
+function form_set_value($element, $value, FormStateInterface $form_state) {
\Drupal::formBuilder()->setValue($element, $value, $form_state);
}
@@ -1255,12 +1255,12 @@ function form_process_checkboxes($element) {
* An associative array containing the properties and children of the
* form actions container.
* @param $form_state
- * The $form_state array for the form this element belongs to.
+ * The current state of the form for the form this element belongs to.
*
* @return
* The processed element.
*/
-function form_process_actions($element, &$form_state) {
+function form_process_actions($element, FormStateInterface $form_state) {
$element['#attributes']['class'][] = 'form-actions';
return $element;
}
@@ -1318,14 +1318,14 @@ function form_pre_render_actions_dropbutton(array $element) {
* An associative array containing the properties and children of the
* generic input element.
* @param $form_state
- * The $form_state array for the form this element belongs to.
+ * The current state of the form for the form this element belongs to.
*
* @return
* The processed element.
*
* @see form_validate_pattern()
*/
-function form_process_pattern($element, &$form_state) {
+function form_process_pattern($element, FormStateInterface $form_state) {
if (isset($element['#pattern']) && !isset($element['#attributes']['pattern'])) {
$element['#attributes']['pattern'] = $element['#pattern'];
$element['#element_validate'][] = 'form_validate_pattern';
@@ -1341,11 +1341,11 @@ function form_process_pattern($element, &$form_state) {
* An associative array containing the properties and children of the
* generic form element.
* @param $form_state
- * The $form_state array for the form this element belongs to.
+ * The current state of the form for the form this element belongs to.
*
* @see form_process_pattern()
*/
-function form_validate_pattern($element, &$form_state) {
+function form_validate_pattern($element, FormStateInterface $form_state) {
if ($element['#value'] !== '') {
// The pattern must match the entire string and should have the same
// behavior as the RegExp object in ECMA 262.
@@ -1368,12 +1368,12 @@ function form_validate_pattern($element, &$form_state) {
* An associative array containing the properties and children of the
* container.
* @param $form_state
- * The $form_state array for the form this element belongs to.
+ * The current state of the form for the form this element belongs to.
*
* @return
* The processed element.
*/
-function form_process_container($element, &$form_state) {
+function form_process_container($element, FormStateInterface $form_state) {
// Generate the ID of the element if it's not explicitly given.
if (!isset($element['#id'])) {
$element['#id'] = drupal_html_id(implode('-', $element['#parents']) . '-wrapper');
@@ -1568,7 +1568,7 @@ function form_process_tableselect($element) {
* @param array $element
* An associative array containing the properties and children of the
* table element.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @return array
@@ -1577,7 +1577,7 @@ function form_process_tableselect($element) {
* @see form_process_tableselect()
* @see theme_tableselect()
*/
-function form_process_table($element, &$form_state) {
+function form_process_table($element, FormStateInterface $form_state) {
if ($element['#tableselect']) {
if ($element['#multiple']) {
$value = is_array($element['#value']) ? $element['#value'] : array();
@@ -1694,10 +1694,10 @@ function form_process_table($element, &$form_state) {
* @param array $element
* An associative array containing the properties and children of the
* table element.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
-function form_validate_table($element, &$form_state) {
+function form_validate_table($element, FormStateInterface $form_state) {
// Skip this validation if the button to submit the form does not require
// selected table row data.
if (empty($form_state['triggering_element']['#tableselect'])) {
@@ -1745,7 +1745,7 @@ function form_validate_table($element, &$form_state) {
* - #disabled: (optional) Should be set to TRUE in case an existing machine
* name must not be changed after initial creation.
*/
-function form_process_machine_name($element, &$form_state) {
+function form_process_machine_name($element, FormStateInterface $form_state) {
// We need to pass the langcode to the client.
$language = \Drupal::languageManager()->getCurrentLanguage();
@@ -1829,7 +1829,7 @@ function form_process_machine_name($element, &$form_state) {
*
* Note that #maxlength is validated by _form_validate() already.
*/
-function form_validate_machine_name(&$element, &$form_state) {
+function form_validate_machine_name(&$element, FormStateInterface $form_state) {
// Verify that the machine name not only consists of replacement tokens.
if (preg_match('@^' . $element['#machine_name']['replace'] . '+$@', $element['#value'])) {
form_error($element, $form_state, t('The machine-readable name must contain unique characters.'));
@@ -1870,12 +1870,12 @@ function form_validate_machine_name(&$element, &$form_state) {
* element. Note that $element must be taken by reference here, so processed
* child elements are taken over into $form_state.
* @param $form_state
- * The $form_state array for the form this element belongs to.
+ * The current state of the form for the form this element belongs to.
*
* @return
* The processed element.
*/
-function form_process_group(&$element, &$form_state) {
+function form_process_group(&$element, FormStateInterface $form_state) {
$parents = implode('][', $element['#parents']);
// Each details element forms a new group. The #type 'vertical_tabs' basically
@@ -1994,12 +1994,12 @@ function form_pre_render_group($element) {
* An associative array containing the properties and children of the
* details element.
* @param $form_state
- * The $form_state array for the form this vertical tab widget belongs to.
+ * The current state of the form for the form this vertical tab widget belongs to.
*
* @return
* The processed element.
*/
-function form_process_vertical_tabs($element, &$form_state) {
+function form_process_vertical_tabs($element, FormStateInterface $form_state) {
// Inject a new details as child, so that form_process_details() processes
// this details element like any other details.
$element['group'] = array(
@@ -2088,13 +2088,13 @@ function template_preprocess_vertical_tabs(&$variables) {
* autocomplete JavaScript library.
* - #autocomplete_route_parameters: The parameters to be used in conjunction
* with the route name.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* The form element.
*/
-function form_process_autocomplete($element, &$form_state) {
+function form_process_autocomplete($element, FormStateInterface $form_state) {
$access = FALSE;
if (!empty($element['#autocomplete_route_name'])) {
$parameters = isset($element['#autocomplete_route_parameters']) ? $element['#autocomplete_route_parameters'] : array();
@@ -2254,7 +2254,7 @@ function form_pre_render_email($element) {
*
* Note that #maxlength and #required is validated by _form_validate() already.
*/
-function form_validate_email(&$element, &$form_state) {
+function form_validate_email(&$element, FormStateInterface $form_state) {
$value = trim($element['#value']);
form_set_value($element, $value, $form_state);
@@ -2325,7 +2325,7 @@ function form_pre_render_range($element) {
*
* Note that #required is validated by _form_validate() already.
*/
-function form_validate_number(&$element, &$form_state) {
+function form_validate_number(&$element, FormStateInterface $form_state) {
$value = $element['#value'];
if ($value === '') {
return;
@@ -2433,7 +2433,7 @@ function form_pre_render_search($element) {
*
* Note that #maxlength and #required is validated by _form_validate() already.
*/
-function form_validate_url(&$element, &$form_state) {
+function form_validate_url(&$element, FormStateInterface $form_state) {
$value = trim($element['#value']);
form_set_value($element, $value, $form_state);
@@ -2445,7 +2445,7 @@ function form_validate_url(&$element, &$form_state) {
/**
* Form element validation handler for #type 'color'.
*/
-function form_validate_color(&$element, &$form_state) {
+function form_validate_color(&$element, FormStateInterface $form_state) {
$value = trim($element['#value']);
// Default to black if no value is given.
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 214ce28..121badc 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -7,6 +7,7 @@ use Drupal\Core\Config\BootstrapConfigStorageFactory;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\DatabaseExceptionWrapper;
use Drupal\Core\Database\Install\TaskException;
+use Drupal\Core\Form\FormState;
use Drupal\Core\Installer\Exception\AlreadyInstalledException;
use Drupal\Core\Installer\Exception\InstallerException;
use Drupal\Core\Installer\Exception\NoProfilesException;
@@ -157,7 +158,7 @@ function install_drupal($settings = array()) {
* submission is for, and the values are used as the $form_state['values']
* array that is passed on to the form submission via drupal_form_submit()).
*
- * @see drupal_form_submit()
+ * @see \Drupal\Core\Form\FormBuilderInterface::submitForm()
*/
function install_state_defaults() {
$defaults = array(
@@ -804,12 +805,12 @@ function install_tasks_to_display($install_state) {
function install_get_form($form_id, array &$install_state) {
// Ensure the form will not redirect, since install_run_tasks() uses a custom
// redirection logic.
- $form_state = array(
+ $form_state = new FormState(array(
'build_info' => array(
'args' => array(&$install_state),
),
'no_redirect' => TRUE,
- );
+ ));
$form_builder = \Drupal::formBuilder();
if ($install_state['interactive']) {
$form = $form_builder->buildForm($form_id, $form_state);
diff --git a/core/lib/Drupal/Core/Action/ConfigurableActionBase.php b/core/lib/Drupal/Core/Action/ConfigurableActionBase.php
index c32695b..e036880 100644
--- a/core/lib/Drupal/Core/Action/ConfigurableActionBase.php
+++ b/core/lib/Drupal/Core/Action/ConfigurableActionBase.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Action;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Core\Action\ActionBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;
/**
@@ -49,7 +50,7 @@ abstract class ConfigurableActionBase extends ActionBase implements Configurable
/**
* {@inheritdoc}
*/
- public function validateConfigurationForm(array &$form, array &$form_state) {
+ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
diff --git a/core/lib/Drupal/Core/Condition/ConditionPluginBase.php b/core/lib/Drupal/Core/Condition/ConditionPluginBase.php
index 221e3b5..a745065 100644
--- a/core/lib/Drupal/Core/Condition/ConditionPluginBase.php
+++ b/core/lib/Drupal/Core/Condition/ConditionPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Condition;
use Drupal\Core\Executable\ExecutablePluginBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Provides a basis for fulfilling contexts for condition plugins.
@@ -39,7 +40,7 @@ abstract class ConditionPluginBase extends ExecutablePluginBase implements Condi
/**
* {@inheritdoc}
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['negate'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Negate the condition.'),
@@ -51,13 +52,13 @@ abstract class ConditionPluginBase extends ExecutablePluginBase implements Condi
/**
* {@inheritdoc}
*/
- public function validateConfigurationForm(array &$form, array &$form_state) {
+ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['negate'] = $form_state['values']['negate'];
}
diff --git a/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php b/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php
index 3729f2d..ef02177 100644
--- a/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php
+++ b/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php
@@ -11,6 +11,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Defines a class to build a draggable listing of configuration entities.
@@ -102,7 +103,7 @@ abstract class DraggableListBuilder extends ConfigEntityListBuilder implements F
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form[$this->entitiesKey] = array(
'#type' => 'table',
'#header' => $this->buildHeader(),
@@ -138,14 +139,14 @@ abstract class DraggableListBuilder extends ConfigEntityListBuilder implements F
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
// No validation.
}
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
foreach ($form_state['values'][$this->entitiesKey] as $id => $value) {
if (isset($this->entities[$id]) && $this->entities[$id]->get($this->weightKey) != $value['weight']) {
// Save entity only when its weight was changed.
diff --git a/core/lib/Drupal/Core/Controller/FormController.php b/core/lib/Drupal/Core/Controller/FormController.php
index a8c44e5..95e3eb5 100644
--- a/core/lib/Drupal/Core/Controller/FormController.php
+++ b/core/lib/Drupal/Core/Controller/FormController.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Controller;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Form\FormBuilderInterface;
+use Drupal\Core\Form\FormState;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -66,7 +67,7 @@ abstract class FormController {
// Add the form and form_state to trick the getArguments method of the
// controller resolver.
- $form_state = array();
+ $form_state = new FormState();
$request->attributes->set('form', array());
$request->attributes->set('form_state', $form_state);
$args = $this->controllerResolver->getArguments($request, array($form_object, 'buildForm'));
diff --git a/core/lib/Drupal/Core/Display/VariantBase.php b/core/lib/Drupal/Core/Display/VariantBase.php
index ef7346d..b39d9b3 100644
--- a/core/lib/Drupal/Core/Display/VariantBase.php
+++ b/core/lib/Drupal/Core/Display/VariantBase.php
@@ -7,6 +7,7 @@
namespace Drupal\Core\Display;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Plugin\PluginDependencyTrait;
use Drupal\Core\Session\AccountInterface;
@@ -100,7 +101,7 @@ abstract class VariantBase extends PluginBase implements VariantInterface {
/**
* {@inheritdoc}
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['label'] = array(
'#type' => 'textfield',
'#title' => $this->t('Label'),
@@ -114,13 +115,13 @@ abstract class VariantBase extends PluginBase implements VariantInterface {
/**
* {@inheritdoc}
*/
- public function validateConfigurationForm(array &$form, array &$form_state) {
+ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['label'] = $form_state['values']['label'];
}
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityConfirmFormBase.php b/core/lib/Drupal/Core/Entity/ContentEntityConfirmFormBase.php
index 686cdae..fc5bd8e 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityConfirmFormBase.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityConfirmFormBase.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Entity;
use Drupal\Core\Form\ConfirmFormHelper;
use Drupal\Core\Form\ConfirmFormInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Provides a generic base class for an entity-based confirmation form.
@@ -53,7 +54,7 @@ abstract class ContentEntityConfirmFormBase extends ContentEntityForm implements
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['#title'] = $this->getQuestion();
@@ -72,7 +73,7 @@ abstract class ContentEntityConfirmFormBase extends ContentEntityForm implements
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
// Do not attach fields to the confirm form.
return $form;
}
@@ -80,7 +81,7 @@ abstract class ContentEntityConfirmFormBase extends ContentEntityForm implements
/**
* {@inheritdoc}
*/
- protected function actions(array $form, array &$form_state) {
+ protected function actions(array $form, FormStateInterface $form_state) {
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->getConfirmText();
unset($actions['delete']);
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityForm.php b/core/lib/Drupal/Core/Entity/ContentEntityForm.php
index 8722a9c..d2fc480 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityForm.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityForm.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Entity;
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\entity\Entity\EntityFormDisplay;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -47,7 +48,7 @@ class ContentEntityForm extends EntityForm implements ContentEntityFormInterface
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$this->getFormDisplay($form_state)->buildForm($this->entity, $form, $form_state);
return $form;
@@ -56,7 +57,7 @@ class ContentEntityForm extends EntityForm implements ContentEntityFormInterface
/**
* {@inheritdoc}
*/
- public function validate(array $form, array &$form_state) {
+ public function validate(array $form, FormStateInterface $form_state) {
$this->updateFormLangcode($form_state);
$entity = $this->buildEntity($form, $form_state);
$this->getFormDisplay($form_state)->validateFormValues($entity, $form, $form_state);
@@ -70,7 +71,7 @@ class ContentEntityForm extends EntityForm implements ContentEntityFormInterface
/**
* Initialize the form state and the entity before the first form build.
*/
- protected function init(array &$form_state) {
+ protected function init(FormStateInterface $form_state) {
// Ensure we act on the translation object corresponding to the current form
// language.
$langcode = $this->getFormLangcode($form_state);
@@ -85,7 +86,7 @@ class ContentEntityForm extends EntityForm implements ContentEntityFormInterface
/**
* {@inheritdoc}
*/
- public function getFormLangcode(array &$form_state) {
+ public function getFormLangcode(FormStateInterface $form_state) {
if (empty($form_state['langcode'])) {
// Imply a 'view' operation to ensure users edit entities in the same
// language they are displayed. This allows to keep contextual editing
@@ -98,14 +99,14 @@ class ContentEntityForm extends EntityForm implements ContentEntityFormInterface
/**
* {@inheritdoc}
*/
- public function isDefaultFormLangcode(array $form_state) {
+ public function isDefaultFormLangcode(FormStateInterface $form_state) {
return $this->getFormLangcode($form_state) == $this->entity->getUntranslated()->language()->id;
}
/**
* {@inheritdoc}
*/
- protected function copyFormValuesToEntity(EntityInterface $entity, array $form, array &$form_state) {
+ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
// First, extract values from widgets.
$extracted = $this->getFormDisplay($form_state)->extractFormValues($entity, $form, $form_state);
@@ -122,14 +123,14 @@ class ContentEntityForm extends EntityForm implements ContentEntityFormInterface
/**
* {@inheritdoc}
*/
- public function getFormDisplay(array $form_state) {
+ public function getFormDisplay(FormStateInterface $form_state) {
return isset($form_state['form_display']) ? $form_state['form_display'] : NULL;
}
/**
* {@inheritdoc}
*/
- public function setFormDisplay(EntityFormDisplayInterface $form_display, array &$form_state) {
+ public function setFormDisplay(EntityFormDisplayInterface $form_display, FormStateInterface $form_state) {
$form_state['form_display'] = $form_display;
return $this;
}
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityFormInterface.php b/core/lib/Drupal/Core/Entity/ContentEntityFormInterface.php
index c006306..4d5cf4d 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityFormInterface.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityFormInterface.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Entity;
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Defines a common interface for content entity form classes.
@@ -17,13 +18,13 @@ interface ContentEntityFormInterface extends EntityFormInterface {
/**
* Returns the form display.
*
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return \Drupal\Core\Entity\Display\EntityFormDisplayInterface.
* The current form display.
*/
- public function getFormDisplay(array $form_state);
+ public function getFormDisplay(FormStateInterface $form_state);
/**
* Sets the form display.
@@ -33,9 +34,9 @@ interface ContentEntityFormInterface extends EntityFormInterface {
*
* @param \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display
* The form display that the current form operates with.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function setFormDisplay(EntityFormDisplayInterface $form_display, array &$form_state);
+ public function setFormDisplay(EntityFormDisplayInterface $form_display, FormStateInterface $form_state);
}
diff --git a/core/lib/Drupal/Core/Entity/Display/EntityFormDisplayInterface.php b/core/lib/Drupal/Core/Entity/Display/EntityFormDisplayInterface.php
index 7d8e3b5..4ecc887 100644
--- a/core/lib/Drupal/Core/Entity/Display/EntityFormDisplayInterface.php
+++ b/core/lib/Drupal/Core/Entity/Display/EntityFormDisplayInterface.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Entity\Display;
use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Provides a common interface for entity form displays.
@@ -93,10 +94,10 @@ interface EntityFormDisplayInterface extends EntityDisplayInterface {
* $form_state['values']. If not specified, $form['#parents'] is set to an
* empty array, which results in field values located at the top-level of
* $form_state['values'].
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*/
- public function buildForm(ContentEntityInterface $entity, array &$form, array &$form_state);
+ public function buildForm(ContentEntityInterface $entity, array &$form, FormStateInterface $form_state);
/**
* Validates submitted widget values and sets the corresponding form errors.
@@ -122,10 +123,10 @@ interface EntityFormDisplayInterface extends EntityDisplayInterface {
* @param array $form
* The form structure where field elements are attached to. This might be a
* full form structure, or a sub-element of a larger form.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*/
- public function validateFormValues(ContentEntityInterface $entity, array &$form, array &$form_state);
+ public function validateFormValues(ContentEntityInterface $entity, array &$form, FormStateInterface $form_state);
/**
* Extracts field values from the submitted widget values into the entity.
@@ -138,7 +139,7 @@ interface EntityFormDisplayInterface extends EntityDisplayInterface {
* @param array $form
* The form structure where field elements are attached to. This might be a
* full form structure, or a sub-element of a larger form.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*
* @return array
@@ -147,6 +148,6 @@ interface EntityFormDisplayInterface extends EntityDisplayInterface {
* any, do not correspond to widgets and should be extracted manually by
* the caller if needed.
*/
- public function extractFormValues(ContentEntityInterface $entity, array &$form, array &$form_state);
+ public function extractFormValues(ContentEntityInterface $entity, array &$form, FormStateInterface $form_state);
}
diff --git a/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php b/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php
index a86d646..d01d4af 100644
--- a/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Entity;
use Drupal\Core\Form\ConfirmFormHelper;
use Drupal\Core\Form\ConfirmFormInterface;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -56,7 +57,7 @@ abstract class EntityConfirmFormBase extends EntityForm implements ConfirmFormIn
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['#title'] = $this->getQuestion();
@@ -75,7 +76,7 @@ abstract class EntityConfirmFormBase extends EntityForm implements ConfirmFormIn
/**
* {@inheritdoc}
*/
- protected function actions(array $form, array &$form_state) {
+ protected function actions(array $form, FormStateInterface $form_state) {
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->getConfirmText();
unset($actions['delete']);
diff --git a/core/lib/Drupal/Core/Entity/EntityForm.php b/core/lib/Drupal/Core/Entity/EntityForm.php
index dcb9aae..f929a95 100644
--- a/core/lib/Drupal/Core/Entity/EntityForm.php
+++ b/core/lib/Drupal/Core/Entity/EntityForm.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Entity;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
/**
@@ -87,7 +88,7 @@ class EntityForm extends FormBase implements EntityFormInterface {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
// During the initial form build, add this controller to the form state and
// allow for initial preparation before form building and processing.
if (!isset($form_state['controller'])) {
@@ -109,13 +110,13 @@ class EntityForm extends FormBase implements EntityFormInterface {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
}
/**
* Initialize the form state and the entity before the first form build.
*/
- protected function init(array &$form_state) {
+ protected function init(FormStateInterface $form_state) {
// Add the controller to the form state so it can be easily accessed by
// module-provided form handlers there.
$form_state['controller'] = $this;
@@ -133,7 +134,7 @@ class EntityForm extends FormBase implements EntityFormInterface {
*
* @see \Drupal\Core\Entity\EntityForm::build()
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
// Add a process callback.
@@ -156,7 +157,7 @@ class EntityForm extends FormBase implements EntityFormInterface {
*
* @see \Drupal\Core\Entity\EntityForm::form()
*/
- public function processForm($element, $form_state, $form) {
+ public function processForm($element, FormStateInterface $form_state, $form) {
// If the form is cached, process callbacks may not have a valid reference
// to the entity object, hence we must restore it.
$this->entity = $form_state['controller']->getEntity();
@@ -167,7 +168,7 @@ class EntityForm extends FormBase implements EntityFormInterface {
/**
* Returns the action form element for the current entity form.
*/
- protected function actionsElement(array $form, array &$form_state) {
+ protected function actionsElement(array $form, FormStateInterface $form_state) {
$element = $this->actions($form, $form_state);
if (isset($element['delete'])) {
@@ -204,7 +205,7 @@ class EntityForm extends FormBase implements EntityFormInterface {
* @todo Consider introducing a 'preview' action here, since it is used by
* many entity types.
*/
- protected function actions(array $form, array &$form_state) {
+ protected function actions(array $form, FormStateInterface $form_state) {
// @todo Rename the action key from submit to save.
$actions['submit'] = array(
'#type' => 'submit',
@@ -242,7 +243,7 @@ class EntityForm extends FormBase implements EntityFormInterface {
/**
* {@inheritdoc}
*/
- public function validate(array $form, array &$form_state) {
+ public function validate(array $form, FormStateInterface $form_state) {
$this->updateFormLangcode($form_state);
// @todo Remove this.
// Execute legacy global validation handlers.
@@ -261,10 +262,10 @@ class EntityForm extends FormBase implements EntityFormInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * A reference to a keyed array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
// Remove button and internal Form API values from submitted values.
form_state_values_clean($form_state);
$this->entity = $this->buildEntity($form, $form_state);
@@ -276,24 +277,24 @@ class EntityForm extends FormBase implements EntityFormInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * A reference to a keyed array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
// @todo Perform common save operations.
}
/**
* {@inheritdoc}
*/
- public function getFormLangcode(array &$form_state) {
+ public function getFormLangcode(FormStateInterface $form_state) {
return $this->entity->language()->id;
}
/**
* {@inheritdoc}
*/
- public function isDefaultFormLangcode(array $form_state) {
+ public function isDefaultFormLangcode(FormStateInterface $form_state) {
// The entity is not translatable, this is always the default language.
return TRUE;
}
@@ -301,10 +302,10 @@ class EntityForm extends FormBase implements EntityFormInterface {
/**
* Updates the form language to reflect any change to the entity language.
*
- * @param array $form_state
- * A reference to a keyed array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- protected function updateFormLangcode(array &$form_state) {
+ protected function updateFormLangcode(FormStateInterface $form_state) {
// Update the form language as it might have changed.
if (isset($form_state['values']['langcode']) && $this->isDefaultFormLangcode($form_state)) {
$form_state['langcode'] = $form_state['values']['langcode'];
@@ -314,7 +315,7 @@ class EntityForm extends FormBase implements EntityFormInterface {
/**
* {@inheritdoc}
*/
- public function buildEntity(array $form, array &$form_state) {
+ public function buildEntity(array $form, FormStateInterface $form_state) {
$entity = clone $this->entity;
// If you submit a form, the form state comes from caching, which forces
// the controller to be the one before caching. Ensure to have the
@@ -344,10 +345,10 @@ class EntityForm extends FormBase implements EntityFormInterface {
* The entity the current form should operate upon.
* @param array $form
* A nested array of form elements comprising the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- protected function copyFormValuesToEntity(EntityInterface $entity, array $form, array &$form_state) {
+ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
// @todo: This relies on a method that only exists for config and content
// entities, in a different way. Consider moving this logic to a config
// entity specific implementation.
@@ -381,10 +382,10 @@ class EntityForm extends FormBase implements EntityFormInterface {
*
* @param string $hook
* The hook variant name.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- protected function prepareInvokeAll($hook, array &$form_state) {
+ protected function prepareInvokeAll($hook, FormStateInterface $form_state) {
$implementations = $this->moduleHandler->getImplementations($hook);
foreach ($implementations as $module) {
$function = $module . '_' . $hook;
diff --git a/core/lib/Drupal/Core/Entity/EntityFormBuilder.php b/core/lib/Drupal/Core/Entity/EntityFormBuilder.php
index c875754..3a825be 100644
--- a/core/lib/Drupal/Core/Entity/EntityFormBuilder.php
+++ b/core/lib/Drupal/Core/Entity/EntityFormBuilder.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Entity;
use Drupal\Core\Form\FormBuilderInterface;
+use Drupal\Core\Form\FormState;
/**
* Builds entity forms.
@@ -44,10 +45,11 @@ class EntityFormBuilder implements EntityFormBuilderInterface {
/**
* {@inheritdoc}
*/
- public function getForm(EntityInterface $entity, $operation = 'default', array $form_state = array()) {
+ public function getForm(EntityInterface $entity, $operation = 'default', array $form_state_additions = array()) {
$form_object = $this->entityManager->getFormObject($entity->getEntityTypeId(), $operation);
$form_object->setEntity($entity);
+ $form_state = new FormState($form_state_additions);
$form_state['build_info']['callback_object'] = $form_object;
$form_state['build_info']['base_form_id'] = $form_object->getBaseFormID();
$form_state['build_info'] += array('args' => array());
diff --git a/core/lib/Drupal/Core/Entity/EntityFormBuilderInterface.php b/core/lib/Drupal/Core/Entity/EntityFormBuilderInterface.php
index 888abdb..584595f 100644
--- a/core/lib/Drupal/Core/Entity/EntityFormBuilderInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityFormBuilderInterface.php
@@ -24,9 +24,9 @@ interface EntityFormBuilderInterface {
* _entity_form: node.book_outline
* @endcode
* where "book_outline" is the value of $operation.
- * @param array $form_state
- * (optional) An associative array containing the current state of the form.
- * Use this to pass additional information to the form, such as the
+ * @param array $form_state_additions
+ * (optional) An associative array used to build the current state of the
+ * form. Use this to pass additional information to the form, such as the
* langcode. Defaults to an empty array.
*
* @code
@@ -37,6 +37,6 @@ interface EntityFormBuilderInterface {
* @return array
* The processed form for the given entity and operation.
*/
- public function getForm(EntityInterface $entity, $operation = 'default', array $form_state = array());
+ public function getForm(EntityInterface $entity, $operation = 'default', array $form_state_additions = array());
}
diff --git a/core/lib/Drupal/Core/Entity/EntityFormInterface.php b/core/lib/Drupal/Core/Entity/EntityFormInterface.php
index f1aeaa8..31f485a 100644
--- a/core/lib/Drupal/Core/Entity/EntityFormInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityFormInterface.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Entity;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\BaseFormIdInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
/**
@@ -19,24 +20,24 @@ interface EntityFormInterface extends BaseFormIdInterface {
/**
* Returns the code identifying the active form language.
*
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return string
* The form language code.
*/
- public function getFormLangcode(array &$form_state);
+ public function getFormLangcode(FormStateInterface $form_state);
/**
* Checks whether the current form language matches the entity one.
*
- * @param array $form_state
- * A keyed array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return boolean
* Returns TRUE if the entity form language matches the entity one.
*/
- public function isDefaultFormLangcode(array $form_state);
+ public function isDefaultFormLangcode(FormStateInterface $form_state);
/**
* Sets the operation for this form.
@@ -61,8 +62,8 @@ interface EntityFormInterface extends BaseFormIdInterface {
*
* The form entity which has been used for populating form element defaults.
*
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return \Drupal\Core\Entity\EntityInterface
* The current form entity.
@@ -96,23 +97,23 @@ interface EntityFormInterface extends BaseFormIdInterface {
*
* @param array $form
* A nested array form elements comprising the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return \Drupal\Core\Entity\EntityInterface
* An updated copy of the form's entity object.
*/
- public function buildEntity(array $form, array &$form_state);
+ public function buildEntity(array $form, FormStateInterface $form_state);
/**
* Validates the submitted form values of the entity form.
*
* @param array $form
* A nested array form elements comprising the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function validate(array $form, array &$form_state);
+ public function validate(array $form, FormStateInterface $form_state);
/**
* Updates the form's entity by processing this submission's values.
@@ -123,10 +124,10 @@ interface EntityFormInterface extends BaseFormIdInterface {
*
* @param array $form
* A nested array form elements comprising the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function submit(array $form, array &$form_state);
+ public function submit(array $form, FormStateInterface $form_state);
/**
* Sets the string translation service for this form.
diff --git a/core/lib/Drupal/Core/Field/FieldItemBase.php b/core/lib/Drupal/Core/Field/FieldItemBase.php
index a22375e..715bbb7 100644
--- a/core/lib/Drupal/Core/Field/FieldItemBase.php
+++ b/core/lib/Drupal/Core/Field/FieldItemBase.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Field;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\TypedData\DataDefinitionInterface;
use Drupal\Core\TypedData\Plugin\DataType\Map;
use Drupal\Core\TypedData\TypedDataInterface;
@@ -244,14 +245,14 @@ abstract class FieldItemBase extends Map implements FieldItemInterface {
/**
* {@inheritdoc}
*/
- public function settingsForm(array &$form, array &$form_state, $has_data) {
+ public function settingsForm(array &$form, FormStateInterface $form_state, $has_data) {
return array();
}
/**
* {@inheritdoc}
*/
- public function instanceSettingsForm(array $form, array &$form_state) {
+ public function instanceSettingsForm(array $form, FormStateInterface $form_state) {
return array();
}
diff --git a/core/lib/Drupal/Core/Field/FieldItemInterface.php b/core/lib/Drupal/Core/Field/FieldItemInterface.php
index 25bad4e..b3a9269 100644
--- a/core/lib/Drupal/Core/Field/FieldItemInterface.php
+++ b/core/lib/Drupal/Core/Field/FieldItemInterface.php
@@ -7,6 +7,7 @@
namespace Drupal\Core\Field;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\TypedData\ComplexDataInterface;
/**
@@ -333,7 +334,7 @@ interface FieldItemInterface extends ComplexDataInterface {
*
* @param array $form
* The form where the settings form is being included in.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state of the (entire) configuration form.
* @param bool $has_data
* TRUE if the field already has data, FALSE if not.
@@ -341,7 +342,7 @@ interface FieldItemInterface extends ComplexDataInterface {
* @return
* The form definition for the field settings.
*/
- public function settingsForm(array &$form, array &$form_state, $has_data);
+ public function settingsForm(array &$form, FormStateInterface $form_state, $has_data);
/**
* Returns a form for the instance-level settings.
@@ -351,12 +352,12 @@ interface FieldItemInterface extends ComplexDataInterface {
*
* @param array $form
* The form where the settings form is being included in.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state of the (entire) configuration form.
*
* @return array
* The form definition for the field instance settings.
*/
- public function instanceSettingsForm(array $form, array &$form_state);
+ public function instanceSettingsForm(array $form, FormStateInterface $form_state);
}
diff --git a/core/lib/Drupal/Core/Field/FieldItemList.php b/core/lib/Drupal/Core/Field/FieldItemList.php
index 0c6559c..726572f 100644
--- a/core/lib/Drupal/Core/Field/FieldItemList.php
+++ b/core/lib/Drupal/Core/Field/FieldItemList.php
@@ -7,6 +7,7 @@
namespace Drupal\Core\Field;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Session\AccountInterface;
@@ -301,7 +302,7 @@ class FieldItemList extends ItemList implements FieldItemListInterface {
/**
* {@inheritdoc}
*/
- public function defaultValuesForm(array &$form, array &$form_state) {
+ public function defaultValuesForm(array &$form, FormStateInterface $form_state) {
if (empty($this->getFieldDefinition()->default_value_function)) {
// Place the input in a separate place in the submitted values tree.
$widget = $this->defaultValueWidget($form_state);
@@ -316,7 +317,7 @@ class FieldItemList extends ItemList implements FieldItemListInterface {
/**
* {@inheritdoc}
*/
- public function defaultValuesFormValidate(array $element, array &$form, array &$form_state) {
+ public function defaultValuesFormValidate(array $element, array &$form, FormStateInterface $form_state) {
// Extract the submitted value, and validate it.
$widget = $this->defaultValueWidget($form_state);
$widget->extractFormValues($this, $element, $form_state);
@@ -331,7 +332,7 @@ class FieldItemList extends ItemList implements FieldItemListInterface {
/**
* {@inheritdoc}
*/
- public function defaultValuesFormSubmit(array $element, array &$form, array &$form_state) {
+ public function defaultValuesFormSubmit(array $element, array &$form, FormStateInterface $form_state) {
// Extract the submitted value, and return it as an array.
$widget = $this->defaultValueWidget($form_state);
$widget->extractFormValues($this, $element, $form_state);
@@ -348,13 +349,13 @@ class FieldItemList extends ItemList implements FieldItemListInterface {
/**
* Returns the widget object used in default value form.
*
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state of the (entire) configuration form.
*
* @return \Drupal\Core\Field\WidgetInterface
* A Widget object.
*/
- protected function defaultValueWidget(array &$form_state) {
+ protected function defaultValueWidget(FormStateInterface $form_state) {
if (!isset($form_state['default_value_widget'])) {
$entity = $this->getEntity();
diff --git a/core/lib/Drupal/Core/Field/FieldItemListInterface.php b/core/lib/Drupal/Core/Field/FieldItemListInterface.php
index 0a1583b..ddfe26b 100644
--- a/core/lib/Drupal/Core/Field/FieldItemListInterface.php
+++ b/core/lib/Drupal/Core/Field/FieldItemListInterface.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Field;
use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessibleInterface;
use Drupal\Core\TypedData\ListInterface;
@@ -188,13 +189,13 @@ interface FieldItemListInterface extends ListInterface, AccessibleInterface {
*
* @param array $form
* The form where the settings form is being included in.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state of the (entire) configuration form.
*
* @return array
* The form definition for the field instance default value.
*/
- public function defaultValuesForm(array &$form, array &$form_state);
+ public function defaultValuesForm(array &$form, FormStateInterface $form_state);
/**
* Validates the submitted default value.
@@ -206,10 +207,10 @@ interface FieldItemListInterface extends ListInterface, AccessibleInterface {
* The default value form element.
* @param array $form
* The form where the settings form is being included in.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state of the (entire) configuration form.
*/
- public function defaultValuesFormValidate(array $element, array &$form, array &$form_state);
+ public function defaultValuesFormValidate(array $element, array &$form, FormStateInterface $form_state);
/**
* Processes the submitted default value.
@@ -221,13 +222,13 @@ interface FieldItemListInterface extends ListInterface, AccessibleInterface {
* The default value form element.
* @param array $form
* The form where the settings form is being included in.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state of the (entire) configuration form.
*
* @return array
* The field instance default value.
*/
- public function defaultValuesFormSubmit(array $element, array &$form, array &$form_state);
+ public function defaultValuesFormSubmit(array $element, array &$form, FormStateInterface $form_state);
/**
* Processes the default value before being applied.
diff --git a/core/lib/Drupal/Core/Field/FormatterBase.php b/core/lib/Drupal/Core/Field/FormatterBase.php
index ed309a9..a3ad53e 100644
--- a/core/lib/Drupal/Core/Field/FormatterBase.php
+++ b/core/lib/Drupal/Core/Field/FormatterBase.php
@@ -7,6 +7,8 @@
namespace Drupal\Core\Field;
+use Drupal\Core\Form\FormStateInterface;
+
/**
* Base class for 'Field formatter' plugin implementations.
*
@@ -106,7 +108,7 @@ abstract class FormatterBase extends PluginSettingsBase implements FormatterInte
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
return array();
}
diff --git a/core/lib/Drupal/Core/Field/FormatterInterface.php b/core/lib/Drupal/Core/Field/FormatterInterface.php
index 9db9857..8596e6b 100644
--- a/core/lib/Drupal/Core/Field/FormatterInterface.php
+++ b/core/lib/Drupal/Core/Field/FormatterInterface.php
@@ -7,6 +7,8 @@
namespace Drupal\Core\Field;
+use Drupal\Core\Form\FormStateInterface;
+
/**
* Interface definition for field formatter plugins.
*
@@ -23,13 +25,13 @@ interface FormatterInterface extends PluginSettingsInterface {
*
* @param array $form
* The form where the settings form is being included in.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* The form elements for the formatter settings.
*/
- public function settingsForm(array $form, array &$form_state);
+ public function settingsForm(array $form, FormStateInterface $form_state);
/**
* Returns a short summary for the current formatter settings.
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php
index 4a0436b..0e43ac1 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php
@@ -7,6 +7,8 @@
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
+use Drupal\Core\Form\FormStateInterface;
+
/**
* Plugin implementation of the 'number_decimal' formatter.
*
@@ -40,7 +42,7 @@ class DecimalFormatter extends NumericFormatterBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$elements = parent::settingsForm($form, $form_state);
$elements['decimal_separator'] = array(
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php
index cc360b9..dc0fe82 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Parent plugin for decimal and integer formatters.
@@ -18,7 +19,7 @@ abstract class NumericFormatterBase extends FormatterBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$options = array(
'' => t('- None -'),
'.' => t('Decimal point'),
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
index fd20d22..6819f79 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Field\Plugin\Field\FieldType;
use Drupal\Core\Field\FieldItemBase;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\TypedData\AllowedValuesInterface;
use Drupal\Core\TypedData\DataDefinition;
@@ -64,7 +65,7 @@ class BooleanItem extends FieldItemBase implements AllowedValuesInterface {
/**
* {@inheritdoc}
*/
- public function settingsForm(array &$form, array &$form_state, $has_data) {
+ public function settingsForm(array &$form, FormStateInterface $form_state, $has_data) {
$element['on_label'] = array(
'#type' => 'textfield',
'#title' => $this->t('"On" label'),
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php
index 10d03b3..3f371fb 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Field\Plugin\Field\FieldType;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\TypedData\DataDefinition;
/**
@@ -63,7 +64,7 @@ class DecimalItem extends NumericItemBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array &$form, array &$form_state, $has_data) {
+ public function settingsForm(array &$form, FormStateInterface $form_state, $has_data) {
$element = array();
$settings = $this->getSettings();
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php
index 41a7032..28846bb 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Field\Plugin\Field\FieldType;
use Drupal\Core\Field\FieldItemBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Base class for numeric configurable field types.
@@ -29,7 +30,7 @@ abstract class NumericItemBase extends FieldItemBase {
/**
* {@inheritdoc}
*/
- public function instanceSettingsForm(array $form, array &$form_state) {
+ public function instanceSettingsForm(array $form, FormStateInterface $form_state) {
$element = array();
$settings = $this->getSettings();
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/BooleanCheckboxWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/BooleanCheckboxWidget.php
index 711a9b2..3069af3 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/BooleanCheckboxWidget.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/BooleanCheckboxWidget.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'boolean_checkbox' widget.
@@ -36,7 +37,7 @@ class BooleanCheckboxWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['display_label'] = array(
'#type' => 'checkbox',
'#title' => t('Use field label instead of the "On label" as label'),
@@ -61,7 +62,7 @@ class BooleanCheckboxWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['value'] = $element + array(
'#type' => 'checkbox',
'#default_value' => !empty($items[0]->value),
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php
index 15bc2cc..ce60ebc 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'email_default' widget.
@@ -35,7 +36,7 @@ class EmailDefaultWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['placeholder'] = array(
'#type' => 'textfield',
'#title' => t('Placeholder'),
@@ -65,7 +66,7 @@ class EmailDefaultWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['value'] = $element + array(
'#type' => 'email',
'#default_value' => isset($items[$delta]->value) ? $items[$delta]->value : NULL,
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php
index fa31ce7..0f5020c 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\Validator\ConstraintViolationInterface;
/**
@@ -38,7 +39,7 @@ class NumberWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['placeholder'] = array(
'#type' => 'textfield',
'#title' => t('Placeholder'),
@@ -68,7 +69,7 @@ class NumberWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$value = isset($items[$delta]->value) ? $items[$delta]->value : NULL;
$field_settings = $this->getFieldSettings();
@@ -113,7 +114,7 @@ class NumberWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function errorElement(array $element, ConstraintViolationInterface $error, array $form, array &$form_state) {
+ public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, FormStateInterface $form_state) {
return $element['value'];
}
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php
index fae98b1..8658dd0 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'string_textarea' widget.
@@ -36,7 +37,7 @@ class StringTextareaWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['rows'] = array(
'#type' => 'number',
'#title' => t('Rows'),
@@ -71,7 +72,7 @@ class StringTextareaWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['value'] = $element + array(
'#type' => 'textarea',
'#default_value' => $items[$delta]->value,
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringWidget.php
index ed1d928..853e661 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringWidget.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringWidget.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'string' widget.
@@ -36,7 +37,7 @@ class StringWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['size'] = array(
'#type' => 'number',
'#title' => t('Size of textfield'),
@@ -71,7 +72,7 @@ class StringWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['value'] = $element + array(
'#type' => 'textfield',
'#default_value' => isset($items[$delta]->value) ? $items[$delta]->value : NULL,
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/UriWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/UriWidget.php
index 39606c6..8be947c 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/UriWidget.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/UriWidget.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'uri' widget.
@@ -36,7 +37,7 @@ class UriWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['size'] = array(
'#type' => 'number',
'#title' => $this->t('Size of URI field'),
@@ -71,7 +72,7 @@ class UriWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['value'] = $element + array(
'#type' => 'url',
'#default_value' => isset($items[$delta]->value) ? $items[$delta]->value : NULL,
diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php
index 1fe4939..89f501c 100644
--- a/core/lib/Drupal/Core/Field/WidgetBase.php
+++ b/core/lib/Drupal/Core/Field/WidgetBase.php
@@ -10,6 +10,7 @@ namespace Drupal\Core\Field;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\SortArray;
use Drupal\Component\Utility\String;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\Validator\ConstraintViolationInterface;
use Symfony\Component\Validator\ConstraintViolationListInterface;
@@ -58,7 +59,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
/**
* {@inheritdoc}
*/
- public function form(FieldItemListInterface $items, array &$form, array &$form_state, $get_delta = NULL) {
+ public function form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL) {
$field_name = $this->fieldDefinition->getName();
$parents = $form['#parents'];
@@ -140,7 +141,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
* - AHAH-'add more' button
* - table display and drag-n-drop value reordering
*/
- protected function formMultipleElements(FieldItemListInterface $items, array &$form, array &$form_state) {
+ protected function formMultipleElements(FieldItemListInterface $items, array &$form, FormStateInterface $form_state) {
$field_name = $this->fieldDefinition->getName();
$cardinality = $this->fieldDefinition->getFieldStorageDefinition()->getCardinality();
$parents = $form['#parents'];
@@ -238,7 +239,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
* This stores the final location of the field within the form structure so
* that flagErrors() can assign validation errors to the right form element.
*/
- public static function afterBuild(array $element, array &$form_state) {
+ public static function afterBuild(array $element, FormStateInterface $form_state) {
$parents = $element['#field_parents'];
$field_name = $element['#field_name'];
@@ -252,7 +253,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
/**
* Submission handler for the "Add another item" button.
*/
- public static function addMoreSubmit(array $form, array &$form_state) {
+ public static function addMoreSubmit(array $form, FormStateInterface $form_state) {
$button = $form_state['triggering_element'];
// Go one level up in the form, to the widgets container.
@@ -274,7 +275,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
* This returns the new page content to replace the page content made obsolete
* by the form submission.
*/
- public static function addMoreAjax(array $form, array $form_state) {
+ public static function addMoreAjax(array $form, FormStateInterface $form_state) {
$button = $form_state['triggering_element'];
// Go one level up in the form, to the widgets container.
@@ -296,7 +297,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
/**
* Generates the form element for a single copy of the widget.
*/
- protected function formSingleElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ protected function formSingleElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$entity = $items->getEntity();
$element += array(
@@ -327,7 +328,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
/**
* {@inheritdoc}
*/
- public function extractFormValues(FieldItemListInterface $items, array $form, array &$form_state) {
+ public function extractFormValues(FieldItemListInterface $items, array $form, FormStateInterface $form_state) {
$field_name = $this->fieldDefinition->getName();
// Extract the values from $form_state['values'].
@@ -372,7 +373,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
/**
* {@inheritdoc}
*/
- public function flagErrors(FieldItemListInterface $items, ConstraintViolationListInterface $violations, array $form, array &$form_state) {
+ public function flagErrors(FieldItemListInterface $items, ConstraintViolationListInterface $violations, array $form, FormStateInterface $form_state) {
$field_name = $this->fieldDefinition->getName();
$field_state = static::getWidgetState($form['#parents'], $field_name, $form_state);
@@ -441,15 +442,15 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
/**
* {@inheritdoc}
*/
- public static function getWidgetState(array $parents, $field_name, array &$form_state) {
- return NestedArray::getValue($form_state, static::getWidgetStateParents($parents, $field_name));
+ public static function getWidgetState(array $parents, $field_name, FormStateInterface $form_state) {
+ return NestedArray::getValue($form_state['storage'], static::getWidgetStateParents($parents, $field_name));
}
/**
* {@inheritdoc}
*/
- public static function setWidgetState(array $parents, $field_name, array &$form_state, array $field_state) {
- NestedArray::setValue($form_state, static::getWidgetStateParents($parents, $field_name), $field_state);
+ public static function setWidgetState(array $parents, $field_name, FormStateInterface $form_state, array $field_state) {
+ NestedArray::setValue($form_state['storage'], static::getWidgetStateParents($parents, $field_name), $field_state);
}
/**
@@ -473,7 +474,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
return array();
}
@@ -487,14 +488,14 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
/**
* {@inheritdoc}
*/
- public function errorElement(array $element, ConstraintViolationInterface $error, array $form, array &$form_state) {
+ public function errorElement(array $element, ConstraintViolationInterface $error, array $form, FormStateInterface $form_state) {
return $element;
}
/**
* {@inheritdoc}
*/
- public function massageFormValues(array $values, array $form, array &$form_state) {
+ public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
return $values;
}
diff --git a/core/lib/Drupal/Core/Field/WidgetBaseInterface.php b/core/lib/Drupal/Core/Field/WidgetBaseInterface.php
index 0d52c1c..db7e0e7 100644
--- a/core/lib/Drupal/Core/Field/WidgetBaseInterface.php
+++ b/core/lib/Drupal/Core/Field/WidgetBaseInterface.php
@@ -7,6 +7,7 @@
namespace Drupal\Core\Field;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\Validator\ConstraintViolationListInterface;
/**
@@ -32,15 +33,15 @@ interface WidgetBaseInterface extends PluginSettingsInterface {
* @param array $form
* An array representing the form that the editing element will be attached
* to.
- * @param array $form_state
- * An array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param int $get_delta
* Used to get only a specific delta value of a multiple value field.
*
* @return array
* The form element array created for this field.
*/
- public function form(FieldItemListInterface $items, array &$form, array &$form_state, $get_delta = NULL);
+ public function form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL);
/**
* Extracts field values from submitted form values.
@@ -51,10 +52,10 @@ interface WidgetBaseInterface extends PluginSettingsInterface {
* @param array $form
* The form structure where field elements are attached to. This might be a
* full form structure, or a sub-element of a larger form.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*/
- public function extractFormValues(FieldItemListInterface $items, array $form, array &$form_state);
+ public function extractFormValues(FieldItemListInterface $items, array $form, FormStateInterface $form_state);
/**
* Reports field-level validation errors against actual form elements.
@@ -66,10 +67,10 @@ interface WidgetBaseInterface extends PluginSettingsInterface {
* @param array $form
* The form structure where field elements are attached to. This might be a
* full form structure, or a sub-element of a larger form.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*/
- public function flagErrors(FieldItemListInterface $items, ConstraintViolationListInterface $violations, array $form, array &$form_state);
+ public function flagErrors(FieldItemListInterface $items, ConstraintViolationListInterface $violations, array $form, FormStateInterface $form_state);
/**
* Retrieves processing information about the widget from $form_state.
@@ -80,7 +81,7 @@ interface WidgetBaseInterface extends PluginSettingsInterface {
* The array of #parents where the field lives in the form.
* @param string $field_name
* The field name.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*
* @return array
@@ -89,7 +90,7 @@ interface WidgetBaseInterface extends PluginSettingsInterface {
* - array_parents: The location of the field's widgets within the $form
* structure. This entry is populated at '#after_build' time.
*/
- public static function getWidgetState(array $parents, $field_name, array &$form_state);
+ public static function getWidgetState(array $parents, $field_name, FormStateInterface $form_state);
/**
* Stores processing information about the widget in $form_state.
@@ -100,12 +101,12 @@ interface WidgetBaseInterface extends PluginSettingsInterface {
* The array of #parents where the widget lives in the form.
* @param string $field_name
* The field name.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
* @param array $field_state
* The array of data to store. See getWidgetState() for the structure and
* content of the array.
*/
- public static function setWidgetState(array $parents, $field_name, array &$form_state, array $field_state);
+ public static function setWidgetState(array $parents, $field_name, FormStateInterface $form_state, array $field_state);
}
diff --git a/core/lib/Drupal/Core/Field/WidgetInterface.php b/core/lib/Drupal/Core/Field/WidgetInterface.php
index feb5d9a..90034a8 100644
--- a/core/lib/Drupal/Core/Field/WidgetInterface.php
+++ b/core/lib/Drupal/Core/Field/WidgetInterface.php
@@ -7,6 +7,7 @@
namespace Drupal\Core\Field;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\Validator\ConstraintViolationInterface;
/**
@@ -30,13 +31,13 @@ interface WidgetInterface extends WidgetBaseInterface {
*
* @param array $form
* The form where the settings form is being included in.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* The form definition for the widget settings.
*/
- public function settingsForm(array $form, array &$form_state);
+ public function settingsForm(array $form, FormStateInterface $form_state);
/**
* Returns a short summary for the current widget settings.
@@ -97,8 +98,8 @@ interface WidgetInterface extends WidgetBaseInterface {
* @param array $form
* The form structure where widgets are being attached to. This might be a
* full form structure, or a sub-element of a larger form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* The form elements for a single widget for this field.
@@ -106,7 +107,7 @@ interface WidgetInterface extends WidgetBaseInterface {
* @see hook_field_widget_form_alter()
* @see hook_field_widget_WIDGET_TYPE_form_alter()
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state);
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state);
/**
* Assigns a field-level validation error to the right widget sub-element.
@@ -122,14 +123,14 @@ interface WidgetInterface extends WidgetBaseInterface {
* @param array $form
* The form structure where field elements are attached to. This might be a
* full form structure, or a sub-element of a larger form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array|bool
* The element on which the error should be flagged, or FALSE to completely
* ignore the violation (use with care!).
*/
- public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, array &$form_state);
+ public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, FormStateInterface $form_state);
/**
* Massages the form values into the format expected for field values.
@@ -144,12 +145,12 @@ interface WidgetInterface extends WidgetBaseInterface {
* @param array $form
* The form structure where field elements are attached to. This might be a
* full form structure, or a sub-element of a larger form.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*
* @return array
* An array of field values, keyed by delta.
*/
- public function massageFormValues(array $values, array $form, array &$form_state);
+ public function massageFormValues(array $values, array $form, FormStateInterface $form_state);
}
diff --git a/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php b/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php
index 765d955..818f345 100644
--- a/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php
+++ b/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\FileTransfer\Form;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
/**
@@ -25,7 +26,7 @@ class FileTransferAuthorizeForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
// If possible, we want to post this form securely via HTTPS.
$form['#https'] = TRUE;
@@ -138,7 +139,7 @@ class FileTransferAuthorizeForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
// Only validate the form if we have collected all of the user input and are
// ready to proceed with updating or installing.
if ($form_state['triggering_element']['#name'] != 'process_updates') {
@@ -168,7 +169,7 @@ class FileTransferAuthorizeForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
switch ($form_state['triggering_element']['#name']) {
case 'process_updates':
diff --git a/core/lib/Drupal/Core/Form/ConfigFormBase.php b/core/lib/Drupal/Core/Form/ConfigFormBase.php
index 8ed7403..f58bc11 100644
--- a/core/lib/Drupal/Core/Form/ConfigFormBase.php
+++ b/core/lib/Drupal/Core/Form/ConfigFormBase.php
@@ -36,9 +36,9 @@ abstract class ConfigFormBase extends FormBase {
}
/**
- * Implements \Drupal\Core\Form\FormInterface::buildForm().
+ * {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
'#type' => 'submit',
@@ -53,9 +53,9 @@ abstract class ConfigFormBase extends FormBase {
}
/**
- * Implements \Drupal\Core\Form\FormInterface::submitForm().
+ * {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
drupal_set_message($this->t('The configuration options have been saved.'));
}
diff --git a/core/lib/Drupal/Core/Form/ConfirmFormBase.php b/core/lib/Drupal/Core/Form/ConfirmFormBase.php
index d44ab47..2896690 100644
--- a/core/lib/Drupal/Core/Form/ConfirmFormBase.php
+++ b/core/lib/Drupal/Core/Form/ConfirmFormBase.php
@@ -43,7 +43,7 @@ abstract class ConfirmFormBase extends FormBase implements ConfirmFormInterface
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form['#title'] = $this->getQuestion();
$form['#attributes']['class'][] = 'confirmation';
diff --git a/core/lib/Drupal/Core/Form/FormBase.php b/core/lib/Drupal/Core/Form/FormBase.php
index b9f04c1..e90dcf6 100644
--- a/core/lib/Drupal/Core/Form/FormBase.php
+++ b/core/lib/Drupal/Core/Form/FormBase.php
@@ -47,13 +47,6 @@ abstract class FormBase implements FormInterface, ContainerInjectionInterface {
protected $configFactory;
/**
- * The form error handler.
- *
- * @var \Drupal\Core\Form\FormErrorInterface
- */
- protected $errorHandler;
-
- /**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
@@ -63,7 +56,7 @@ abstract class FormBase implements FormInterface, ContainerInjectionInterface {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
// Validation is optional.
}
@@ -174,34 +167,23 @@ abstract class FormBase implements FormInterface, ContainerInjectionInterface {
}
/**
- * Returns the form error handler.
- *
- * @return \Drupal\Core\Form\FormErrorInterface
- * The form error handler.
- */
- protected function errorHandler() {
- if (!$this->errorHandler) {
- $this->errorHandler = \Drupal::service('form_builder');
- }
- return $this->errorHandler;
- }
-
- /**
* Files an error against a form element.
*
* @param string $name
* The name of the form element.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param string $message
* (optional) The error message to present to the user.
*
- * @see \Drupal\Core\Form\FormErrorInterface::setErrorByName()
+ * @deprecated Use \Drupal\Core\Form\FormStateInterface::setErrorByName().
+ *
+ * @todo Remove in https://www.drupal.org/node/2308821.
*
* @return $this
*/
- protected function setFormError($name, array &$form_state, $message = '') {
- $this->errorHandler()->setErrorByName($name, $form_state, $message);
+ protected function setFormError($name, FormStateInterface $form_state, $message = '') {
+ $form_state->setErrorByName($name, $message);
return $this;
}
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index c150c29..c92f2d6 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -136,7 +136,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function getFormId($form_arg, &$form_state) {
+ public function getFormId($form_arg, FormStateInterface &$form_state) {
// If the $form_arg is the name of a class, instantiate it. Don't allow
// arbitrary strings to be passed to the class resolver.
if (is_string($form_arg) && class_exists($form_arg)) {
@@ -148,9 +148,9 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
}
// Add the $form_arg as the callback object and determine the form ID.
- $form_state['build_info']['callback_object'] = $form_arg;
+ $form_state->addBuildInfo('callback_object', $form_arg);
if ($form_arg instanceof BaseFormIdInterface) {
- $form_state['build_info']['base_form_id'] = $form_arg->getBaseFormID();
+ $form_state->addBuildInfo('base_form_id', $form_arg->getBaseFormID());
}
return $form_arg->getFormId();
}
@@ -159,12 +159,12 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
* {@inheritdoc}
*/
public function getForm($form_arg) {
- $form_state = array();
+ $form_state = new FormState();
$args = func_get_args();
// Remove $form_arg from the arguments.
unset($args[0]);
- $form_state['build_info']['args'] = array_values($args);
+ $form_state->addBuildInfo('args', array_values($args));
return $this->buildForm($form_arg, $form_state);
}
@@ -172,16 +172,13 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function buildForm($form_id, array &$form_state) {
- // Ensure some defaults; if already set they will not be overridden.
- $form_state += $this->getFormStateDefaults();
-
+ public function buildForm($form_id, FormStateInterface &$form_state) {
// Ensure the form ID is prepared.
$form_id = $this->getFormId($form_id, $form_state);
if (!isset($form_state['input'])) {
$request = $this->requestStack->getCurrentRequest();
- $form_state['input'] = $form_state['method'] == 'get' ? $request->query->all() : $request->request->all();
+ $form_state->set('input', $form_state['method'] == 'get' ? $request->query->all() : $request->request->all());
}
if (isset($_SESSION['batch_form_state'])) {
@@ -210,19 +207,19 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// keys need to be removed after retrieving and preparing the form, except
// any that were already set prior to retrieving the form.
if ($check_cache) {
- $form_state_before_retrieval = $form_state;
+ $form_state_before_retrieval = clone $form_state;
}
$form = $this->retrieveForm($form_id, $form_state);
$this->prepareForm($form_id, $form, $form_state);
- // self::setCache() removes uncacheable $form_state keys defined in
- // self::getUncacheableKeys() in order for multi-step forms to work
+ // self::setCache() removes uncacheable $form_state keys (see properties
+ // in \Drupal\Core\Form\FormState) in order for multi-step forms to work
// properly. This means that form processing logic for single-step forms
// using $form_state['cache'] may depend on data stored in those keys
- // during self::retrieveForm()/self::prepareForm(), but form
- // processing should not depend on whether the form is cached or not, so
- // $form_state is adjusted to match what it would be after a
+ // during self::retrieveForm()/self::prepareForm(), but form processing
+ // should not depend on whether the form is cached or not, so $form_state
+ // is adjusted to match what it would be after a
// self::setCache()/self::getCache() sequence. These exceptions are
// allowed to survive here:
// - always_process: Does not make sense in conjunction with form caching
@@ -231,9 +228,9 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// - temporary: Any assigned data is expected to survives within the same
// page request.
if ($check_cache) {
- $uncacheable_keys = array_flip(array_diff($this->getUncacheableKeys(), array('always_process', 'temporary')));
- $form_state = array_diff_key($form_state, $uncacheable_keys);
- $form_state += $form_state_before_retrieval;
+ $cache_form_state = $form_state->getCacheableArray(array('always_process', 'temporary'));
+ $form_state = $form_state_before_retrieval;
+ $form_state->setFormState($cache_form_state);
}
}
@@ -270,36 +267,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function getFormStateDefaults() {
- return array(
- 'rebuild' => FALSE,
- 'rebuild_info' => array(),
- 'redirect' => NULL,
- // @todo 'args' is usually set, so no other default 'build_info' keys are
- // appended via += $this->getFormStateDefaults().
- 'build_info' => array(
- 'args' => array(),
- 'files' => array(),
- ),
- 'temporary' => array(),
- 'validation_complete' => FALSE,
- 'submitted' => FALSE,
- 'executed' => FALSE,
- 'programmed' => FALSE,
- 'programmed_bypass_access_check' => TRUE,
- 'cache'=> FALSE,
- 'method' => 'post',
- 'groups' => array(),
- 'buttons' => array(),
- 'errors' => array(),
- 'limit_validation_errors' => NULL,
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function rebuildForm($form_id, &$form_state, $old_form = NULL) {
+ public function rebuildForm($form_id, FormStateInterface &$form_state, $old_form = NULL) {
$form = $this->retrieveForm($form_id, $form_state);
// If only parts of the form will be returned to the browser (e.g., Ajax or
@@ -335,7 +303,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// Clear out all group associations as these might be different when
// re-rendering the form.
- $form_state['groups'] = array();
+ $form_state->set('groups', array());
// Return a fully built form that is ready for rendering.
return $this->doBuildForm($form_id, $form, $form_state);
@@ -344,13 +312,13 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function getCache($form_build_id, &$form_state) {
+ public function getCache($form_build_id, FormStateInterface &$form_state) {
if ($form = $this->keyValueExpirableFactory->get('form')->get($form_build_id)) {
$user = $this->currentUser();
if ((isset($form['#cache_token']) && $this->csrfToken->validate($form['#cache_token'])) || (!isset($form['#cache_token']) && $user->isAnonymous())) {
if ($stored_form_state = $this->keyValueExpirableFactory->get('form_state')->get($form_build_id)) {
// Re-populate $form_state for subsequent rebuilds.
- $form_state = $stored_form_state + $form_state;
+ $form_state->setFormState($stored_form_state);
// If the original form is contained in include files, load the files.
// @see form_load_include()
@@ -380,7 +348,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function setCache($form_build_id, $form, $form_state) {
+ public function setCache($form_build_id, $form, FormStateInterface $form_state) {
// 6 hours cache life time for forms should be plenty.
$expire = 21600;
@@ -393,77 +361,42 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
}
// Cache form state.
-
// Store the known list of safe strings for form re-use.
// @todo Ensure we are not storing an excessively large string list in:
// https://www.drupal.org/node/2295823
- $form_state['build_info']['safe_strings'] = SafeMarkup::getAll();
+ $form_state->addBuildInfo('safe_strings', SafeMarkup::getAll());
- if ($data = array_diff_key($form_state, array_flip($this->getUncacheableKeys()))) {
+ if ($data = $form_state->getCacheableArray()) {
$this->keyValueExpirableFactory->get('form_state')->setWithExpire($form_build_id, $data, $expire);
}
}
/**
- * Returns an array of $form_state keys that shouldn't be cached.
- */
- protected function getUncacheableKeys() {
- return array(
- // Public properties defined by form constructors and form handlers.
- 'always_process',
- 'must_validate',
- 'rebuild',
- 'rebuild_info',
- 'redirect',
- 'redirect_route',
- 'no_redirect',
- 'temporary',
- // Internal properties defined by form processing.
- 'buttons',
- 'triggering_element',
- 'complete_form',
- 'groups',
- 'input',
- 'method',
- 'submit_handlers',
- 'validation_complete',
- 'submitted',
- 'executed',
- 'validate_handlers',
- 'values',
- 'errors',
- 'limit_validation_errors',
- );
- }
-
- /**
* {@inheritdoc}
*/
- public function submitForm($form_arg, &$form_state) {
+ public function submitForm($form_arg, FormStateInterface &$form_state) {
if (!isset($form_state['build_info']['args'])) {
$args = func_get_args();
// Remove $form and $form_state from the arguments.
unset($args[0], $args[1]);
- $form_state['build_info']['args'] = array_values($args);
+ $form_state->addBuildInfo('args', array_values($args));
}
- // Merge in default values.
- $form_state += $this->getFormStateDefaults();
// Populate $form_state['input'] with the submitted values before retrieving
// the form, to be consistent with what self::buildForm() does for
// non-programmatic submissions (form builder functions may expect it to be
// there).
- $form_state['input'] = $form_state['values'];
+ $form_state->set('input', $form_state->get('values'));
- $form_state['programmed'] = TRUE;
+ $form_state->set('programmed', TRUE);
$form_id = $this->getFormId($form_arg, $form_state);
$form = $this->retrieveForm($form_id, $form_state);
// Programmed forms are always submitted.
- $form_state['submitted'] = TRUE;
+ $form_state->set('submitted', TRUE);
// Reset form validation.
- $form_state['must_validate'] = TRUE;
+ $form_state->set('must_validate', TRUE);
$this->clearErrors($form_state);
$this->prepareForm($form_id, $form, $form_state);
@@ -473,9 +406,9 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function retrieveForm($form_id, &$form_state) {
+ public function retrieveForm($form_id, FormStateInterface &$form_state) {
// Record the $form_id.
- $form_state['build_info']['form_id'] = $form_id;
+ $form_state->addBuildInfo('form_id', $form_id);
// We save two copies of the incoming arguments: one for modules to use
// when mapping form ids to constructor functions, and another to pass to
@@ -513,20 +446,22 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function processForm($form_id, &$form, &$form_state) {
- $form_state['values'] = array();
+ public function processForm($form_id, &$form, FormStateInterface &$form_state) {
+ $form_state->set('values', array());
// With GET, these forms are always submitted if requested.
if ($form_state['method'] == 'get' && !empty($form_state['always_process'])) {
- if (!isset($form_state['input']['form_build_id'])) {
- $form_state['input']['form_build_id'] = $form['#build_id'];
+ $input = $form_state->get('input');
+ if (!isset($input['form_build_id'])) {
+ $input['form_build_id'] = $form['#build_id'];
}
- if (!isset($form_state['input']['form_id'])) {
- $form_state['input']['form_id'] = $form_id;
+ if (!isset($input['form_id'])) {
+ $input['form_id'] = $form_id;
}
- if (!isset($form_state['input']['form_token']) && isset($form['#token'])) {
- $form_state['input']['form_token'] = $this->csrfToken->get($form['#token']);
+ if (!isset($input['form_token']) && isset($form['#token'])) {
+ $input['form_token'] = $this->csrfToken->get($form['#token']);
}
+ $form_state->set('input', $input);
}
// self::doBuildForm() finishes building the form by calling element
@@ -550,7 +485,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// exactly one submit button in the form, and if so, automatically use it
// as triggering_element.
if ($form_state['programmed'] && !isset($form_state['triggering_element']) && count($form_state['buttons']) == 1) {
- $form_state['triggering_element'] = reset($form_state['buttons']);
+ $form_state->set('triggering_element', reset($form_state['buttons']));
}
$this->formValidator->validateForm($form_id, $form, $form_state);
@@ -594,7 +529,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// Form building functions (e.g., self::handleInputElement()) may use
// $form_state['rebuild'] to determine if they are running in the
// context of a rebuild, so ensure it is set.
- $form_state['rebuild'] = TRUE;
+ $form_state->setRebuild();
$form = $this->rebuildForm($form_id, $form_state, $form);
}
}
@@ -614,14 +549,14 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function prepareForm($form_id, &$form, &$form_state) {
+ public function prepareForm($form_id, &$form, FormStateInterface &$form_state) {
$user = $this->currentUser();
$form['#type'] = 'form';
- $form_state['programmed'] = isset($form_state['programmed']) ? $form_state['programmed'] : FALSE;
+ $form_state->set('programmed', isset($form_state['programmed']) ? $form_state['programmed'] : FALSE);
// Fix the form method, if it is 'get' in $form_state, but not in $form.
- if ($form_state['method'] == 'get' && !isset($form['#method'])) {
+ if ($form_state->get('method') == 'get' && !isset($form['#method'])) {
$form['#method'] = 'get';
}
@@ -718,56 +653,56 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function validateForm($form_id, &$form, &$form_state) {
+ public function validateForm($form_id, &$form, FormStateInterface &$form_state) {
$this->formValidator->validateForm($form_id, $form, $form_state);
}
/**
* {@inheritdoc}
*/
- public function redirectForm($form_state) {
+ public function redirectForm(FormStateInterface $form_state) {
return $this->formSubmitter->redirectForm($form_state);
}
/**
* {@inheritdoc}
*/
- public function executeValidateHandlers(&$form, &$form_state) {
+ public function executeValidateHandlers(&$form, FormStateInterface &$form_state) {
$this->formValidator->executeValidateHandlers($form, $form_state);
}
/**
* {@inheritdoc}
*/
- public function executeSubmitHandlers(&$form, &$form_state) {
+ public function executeSubmitHandlers(&$form, FormStateInterface &$form_state) {
$this->formSubmitter->executeSubmitHandlers($form, $form_state);
}
/**
* {@inheritdoc}
*/
- public function doSubmitForm(&$form, &$form_state) {
+ public function doSubmitForm(&$form, FormStateInterface &$form_state) {
throw new \LogicException('Use FormBuilderInterface::processForm() instead.');
}
/**
* {@inheritdoc}
*/
- public function setErrorByName($name, array &$form_state, $message = '') {
+ public function setErrorByName($name, FormStateInterface &$form_state, $message = '') {
$this->formValidator->setErrorByName($name, $form_state, $message);
}
/**
* {@inheritdoc}
*/
- public function clearErrors(array &$form_state) {
+ public function clearErrors(FormStateInterface &$form_state) {
$this->formValidator->clearErrors($form_state);
}
/**
* {@inheritdoc}
*/
- public function getErrors(array $form_state) {
+ public function getErrors(FormStateInterface &$form_state) {
return $this->formValidator->getErrors($form_state);
}
@@ -781,21 +716,21 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function getError($element, array &$form_state) {
+ public function getError($element, FormStateInterface &$form_state) {
return $this->formValidator->getError($element, $form_state);
}
/**
* {@inheritdoc}
*/
- public function setError(&$element, array &$form_state, $message = '') {
+ public function setError(&$element, FormStateInterface &$form_state, $message = '') {
$this->formValidator->setError($element, $form_state, $message);
}
/**
* {@inheritdoc}
*/
- public function doBuildForm($form_id, &$element, &$form_state) {
+ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state) {
// Initialize as unprocessed.
$element['#processed'] = FALSE;
@@ -826,16 +761,16 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// Store a reference to the complete form in $form_state prior to building
// the form. This allows advanced #process and #after_build callbacks to
// perform changes elsewhere in the form.
- $form_state['complete_form'] = &$element;
+ $form_state->setCompleteForm($element);
// Set a flag if we have a correct form submission. This is always TRUE
// for programmed forms coming from self::submitForm(), or if the form_id
// coming from the POST data is set and matches the current form_id.
if ($form_state['programmed'] || (!empty($form_state['input']) && (isset($form_state['input']['form_id']) && ($form_state['input']['form_id'] == $form_id)))) {
- $form_state['process_input'] = TRUE;
+ $form_state->set('process_input', TRUE);
}
else {
- $form_state['process_input'] = FALSE;
+ $form_state->set('process_input', FALSE);
}
// All form elements should have an #array_parents property.
@@ -931,7 +866,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// If there is a file element, we need to flip a flag so later the
// form encoding can be set.
if (isset($element['#type']) && $element['#type'] == 'file') {
- $form_state['has_file_element'] = TRUE;
+ $form_state->set('has_file_element', TRUE);
}
// Final tasks for the form element after self::doBuildForm() has run for
@@ -949,26 +884,27 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// consistent as we can be across browsers, if no 'triggering_element' has
// been identified yet, default it to the first button.
if (!$form_state['programmed'] && !isset($form_state['triggering_element']) && !empty($form_state['buttons'])) {
- $form_state['triggering_element'] = $form_state['buttons'][0];
+ $form_state->set('triggering_element', $form_state['buttons'][0]);
}
+ $triggering_element = $form_state->get('triggering_element');
// If the triggering element specifies "button-level" validation and
// submit handlers to run instead of the default form-level ones, then add
// those to the form state.
foreach (array('validate', 'submit') as $type) {
- if (isset($form_state['triggering_element']['#' . $type])) {
- $form_state[$type . '_handlers'] = $form_state['triggering_element']['#' . $type];
+ if (isset($triggering_element['#' . $type])) {
+ $form_state->set($type . '_handlers', $triggering_element['#' . $type]);
}
}
// If the triggering element executes submit handlers, then set the form
// state key that's needed for those handlers to run.
- if (!empty($form_state['triggering_element']['#executes_submit_callback'])) {
- $form_state['submitted'] = TRUE;
+ if (!empty($triggering_element['#executes_submit_callback'])) {
+ $form_state->set('submitted', TRUE);
}
// Special processing if the triggering element is a button.
- if (!empty($form_state['triggering_element']['#is_button'])) {
+ if (!empty($triggering_element['#is_button'])) {
// Because there are several ways in which the triggering element could
// have been determined (including from input variables set by
// JavaScript or fallback behavior implemented for IE), and because
@@ -978,7 +914,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// $form_state['values'][BUTTON_NAME] being set. But it's common for
// forms to have several buttons named 'op' and switch on
// $form_state['values']['op'] during submit handler execution.
- $form_state['values'][$form_state['triggering_element']['#name']] = $form_state['triggering_element']['#value'];
+ $form_state->addValue($triggering_element['#name'], $triggering_element['#value']);
}
}
return $element;
@@ -987,7 +923,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* Adds the #name and #value properties of an input element before rendering.
*/
- protected function handleInputElement($form_id, &$element, &$form_state) {
+ protected function handleInputElement($form_id, &$element, FormStateInterface &$form_state) {
if (!isset($element['#name'])) {
$name = array_shift($element['#parents']);
$element['#name'] = $name;
@@ -1101,7 +1037,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
if ($process_input) {
// Detect if the element triggered the submission via Ajax.
if ($this->elementTriggeredScriptedSubmission($element, $form_state)) {
- $form_state['triggering_element'] = $element;
+ $form_state->set('triggering_element', $element);
}
// If the form was submitted by the browser rather than via Ajax, then it
@@ -1113,16 +1049,18 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// form_state_values_clean() and for the self::doBuildForm() code that
// handles a form submission containing no button information in
// \Drupal::request()->request.
- $form_state['buttons'][] = $element;
+ $buttons = $form_state->get('buttons');
+ $buttons[] = $element;
+ $form_state->set('buttons', $buttons);
if ($this->buttonWasClicked($element, $form_state)) {
- $form_state['triggering_element'] = $element;
+ $form_state->set('triggering_element', $element);
}
}
}
// Set the element's value in $form_state['values'], but only, if its key
// does not exist yet (a #value_callback may have already populated it).
- if (!NestedArray::keyExists($form_state['values'], $element['#parents'])) {
+ if (!NestedArray::keyExists($form_state->getValues(), $element['#parents'])) {
$this->setValue($element, $element['#value'], $form_state);
}
}
@@ -1138,7 +1076,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
* element value. An example where this is needed is if there are several
* // buttons all named 'op', and only differing in their value.
*/
- protected function elementTriggeredScriptedSubmission($element, &$form_state) {
+ protected function elementTriggeredScriptedSubmission($element, FormStateInterface &$form_state) {
if (!empty($form_state['input']['_triggering_element_name']) && $element['#name'] == $form_state['input']['_triggering_element_name']) {
if (empty($form_state['input']['_triggering_element_value']) || $form_state['input']['_triggering_element_value'] == $element['#value']) {
return TRUE;
@@ -1167,7 +1105,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
* to know which button was clicked should get that information from
* $form_state['triggering_element'].
*/
- protected function buttonWasClicked($element, &$form_state) {
+ protected function buttonWasClicked($element, FormStateInterface &$form_state) {
// First detect normal 'vanilla' button clicks. Traditionally, all standard
// buttons on a form share the same name (usually 'op'), and the specific
// return value is used to determine which was clicked. This ONLY works as
@@ -1190,8 +1128,10 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
/**
* {@inheritdoc}
*/
- public function setValue($element, $value, &$form_state) {
- NestedArray::setValue($form_state['values'], $element['#parents'], $value, TRUE);
+ public function setValue($element, $value, FormStateInterface &$form_state) {
+ $values = $form_state->getValues();
+ NestedArray::setValue($values, $element['#parents'], $value, TRUE);
+ $form_state->set('values', $values);
}
/**
diff --git a/core/lib/Drupal/Core/Form/FormBuilderInterface.php b/core/lib/Drupal/Core/Form/FormBuilderInterface.php
index 6f42d14..bb4d953 100644
--- a/core/lib/Drupal/Core/Form/FormBuilderInterface.php
+++ b/core/lib/Drupal/Core/Form/FormBuilderInterface.php
@@ -17,13 +17,13 @@ interface FormBuilderInterface extends FormErrorInterface {
*
* @param \Drupal\Core\Form\FormInterface|string $form_arg
* The value is identical to that of self::getForm()'s $form_arg argument.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return string
* The unique string identifying the desired form.
*/
- public function getFormId($form_arg, &$form_state);
+ public function getFormId($form_arg, FormStateInterface &$form_state);
/**
* Gets a renderable form array.
@@ -58,164 +58,12 @@ interface FormBuilderInterface extends FormErrorInterface {
* previous page-load. The form is then passed on for processing, validation
* and submission if there is proper input.
*
- * @param \Drupal\Core\Form\FormInterface|string $form_arg
+ * @param \Drupal\Core\Form\FormInterface|string $form_id
* The value must be one of the following:
* - The name of a class that implements \Drupal\Core\Form\FormInterface.
* - An instance of a class that implements \Drupal\Core\Form\FormInterface.
- * @param array $form_state
- * An array which stores information about the form. This is passed as a
- * reference 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. The following parameters may be set in $form_state to affect
- * how the form is rendered:
- * - build_info: Internal. An associative array of information stored by
- * Form API that is necessary to build and rebuild the form from cache
- * when the original context may no longer be available:
- * - callback: The actual callback to be used to retrieve the form array.
- * Can be any callable. If none is provided $form_id is used as the name
- * of a function to call instead.
- * - args: A list of arguments to pass to the form constructor.
- * - files: An optional array defining include files that need to be
- * loaded for building the form. Each array entry may be the path to a
- * file or another array containing values for the parameters 'type',
- * 'module' and 'name' as needed by module_load_include(). The files
- * listed here are automatically loaded by form_get_cache(). By default
- * the current menu router item's 'file' definition is added, if any.
- * Use form_load_include() to add include files from a form constructor.
- * - form_id: Identification of the primary form being constructed and
- * processed.
- * - base_form_id: Identification for a base form, as declared in the form
- * class's \Drupal\Core\Form\BaseFormIdInterface::getBaseFormId() method.
- * - rebuild_info: Internal. Similar to 'build_info', but pertaining to
- * self::rebuildForm().
- * - rebuild: Normally, after the entire form processing is completed and
- * submit handlers have run, a form is considered to be done and
- * self::redirectForm() will redirect the user to a new page using a GET
- * request (so a browser refresh does not re-submit the form). However, if
- * 'rebuild' has been set to TRUE, then a new copy of the form is
- * immediately built and sent to the browser, instead of a redirect. This
- * is used for multi-step forms, such as wizards and confirmation forms.
- * Normally, $form_state['rebuild'] is set by a submit handler, since its
- * is usually logic within a submit handler that determines whether a form
- * is done or requires another step. However, a validation handler may
- * already set $form_state['rebuild'] to cause the form processing to
- * bypass submit handlers and rebuild the form instead, even if there are
- * no validation errors.
- * - response: Used when a form needs to return some kind of a
- * \Symfony\Component\HttpFoundation\Response object, e.g., a
- * \Symfony\Component\HttpFoundation\BinaryFileResponse when triggering a
- * file download. If you use the $form_state['redirect'] key, it will be
- * used to build a \Symfony\Component\HttpFoundation\RedirectResponse and
- * will populate this key.
- * - redirect: Used to redirect the form on submission. It may either be a
- * string containing the destination URL, or an array of arguments
- * compatible with url(). See url() for complete information.
- * - no_redirect: If set to TRUE the form will NOT perform a redirect,
- * even if 'redirect' is set.
- * - method: The HTTP form method to use for finding the input for this
- * form. May be 'post' or 'get'. Defaults to 'post'. Note that 'get'
- * method forms do not use form ids so are always considered to be
- * submitted, which can have unexpected effects. The 'get' method should
- * only be used on forms that do not change data, as that is exclusively
- * the domain of 'post.'
- * - cache: If set to TRUE the original, unprocessed form structure will be
- * cached, which allows the entire form to be rebuilt from cache. A
- * typical form workflow involves two page requests; first, a form is
- * built and rendered for the user to fill in. Then, the user fills the
- * form in and submits it, triggering a second page request in which the
- * form must be built and processed. By default, $form and $form_state are
- * built from scratch during each of these page requests. Often, it is
- * necessary or desired to persist the $form and $form_state variables
- * from the initial page request to the one that processes the submission.
- * 'cache' can be set to TRUE to do this. A prominent example is an
- * Ajax-enabled form, in which ajax_process_form() enables form caching
- * for all forms that include an element with the #ajax property. (The
- * Ajax handler has no way to build the form itself, so must rely on the
- * cached version.) Note that the persistence of $form and $form_state
- * happens automatically for (multi-step) forms having the 'rebuild' flag
- * set, regardless of the value for 'cache'.
- * - no_cache: If set to TRUE the form will NOT be cached, even if 'cache'
- * is set.
- * - values: An associative array of values submitted to the form. The
- * validation functions and submit functions use this array for nearly all
- * their decision making. (Note that #tree determines whether the values
- * are a flat array or an array whose structure parallels the $form array.
- * See the @link forms_api_reference.html Form API reference @endlink for
- * more information.)
- * - input: The array of 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 the data in the 'values' array exclusively. The most common
- * use of this key is for multi-step forms that need to clear some of the
- * user input when setting 'rebuild'. The values correspond to
- * \Drupal::request()->request or \Drupal::request()->query, depending on
- * the 'method' chosen.
- * - always_process: If TRUE and the method is GET, a form_id is not
- * necessary. 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.
- * - must_validate: Ordinarily, a form is only validated once, but there are
- * times when a form is resubmitted internally and should be validated
- * again. Setting this to TRUE will force that to happen. This is most
- * likely to occur during Ajax operations.
- * - programmed: If TRUE, the form was submitted programmatically, usually
- * invoked via self::submitForm(). Defaults to FALSE.
- * - programmed_bypass_access_check: If TRUE, programmatic form submissions
- * are processed without taking #access into account. Set this to FALSE
- * when submitting a form programmatically with values that may have been
- * input by the user executing the current request; this will cause
- * #access to be respected as it would on a normal form submission.
- * Defaults to TRUE.
- * - process_input: Boolean flag. TRUE signifies correct form submission.
- * This is always TRUE for programmed forms coming from self::submitForm()
- * (see 'programmed' key), or if the form_id coming from the
- * \Drupal::request()->request data is set and matches the current form_id.
- * - submitted: If TRUE, the form has been submitted. Defaults to FALSE.
- * - executed: If TRUE, the form was submitted and has been processed and
- * executed. Defaults to FALSE.
- * - triggering_element: (read-only) The form element that triggered
- * submission, which may or may not be a button (in the case of Ajax
- * forms). This key is often used to distinguish between various buttons
- * in a submit handler, and is also used in Ajax handlers.
- * - has_file_element: Internal. If TRUE, there is a file element and Form
- * API will set the appropriate 'enctype' HTML attribute on the form.
- * - groups: Internal. An array containing references to details elements to
- * render them within vertical tabs.
- * - storage: $form_state['storage'] is not a special key, and no specific
- * support is provided for it in the Form API. By tradition it was
- * the location where application-specific data was stored for
- * communication between the submit, validation, and form builder
- * functions, especially in a multi-step-style form. Form implementations
- * may use any key(s) within $form_state (other than the keys listed here
- * and other reserved ones used by Form API internals) for this kind of
- * storage. The recommended way to ensure that the chosen key doesn't
- * conflict with ones used by the Form API or other modules is to use the
- * module name as the key name or a prefix for the key name. For example,
- * the entity form classes use $this->entity in entity forms,
- * or $form_state['controller']->getEntity() outside the controller, to
- * store information about the entity being edited, and this information
- * stays available across successive clicks of the "Preview" button (if
- * available) as well as when the "Save" button is finally clicked.
- * - buttons: A list containing copies of all submit and button elements in
- * the form.
- * - complete_form: A reference to the $form variable containing the
- * complete form structure. #process, #after_build, #element_validate, and
- * other handlers being invoked on a form element may use this reference
- * to access other information in the form the element is contained in.
- * - temporary: An array holding temporary data accessible during the
- * current page request only. All $form_state properties that are not
- * reserved keys (see form_state_keys_no_cache()) persist throughout a
- * multistep form sequence. Form API provides this key for modules to
- * communicate information across form-related functions during a single
- * page request. It may be used to temporarily save data that does not
- * need to or should not be cached during the whole form workflow; e.g.,
- * data that needs to be accessed during the current form build process
- * only. There is no use-case for this functionality in Drupal core.
- * Information on how certain $form_state properties control redirection
- * behavior after form submission may be found in self::redirectForm().
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* The rendered form. This function may also perform a redirect and hence
@@ -223,12 +71,7 @@ interface FormBuilderInterface extends FormErrorInterface {
*
* @see self::redirectForm()
*/
- public function buildForm($form_id, array &$form_state);
-
- /**
- * Retrieves default values for the $form_state array.
- */
- public function getFormStateDefaults();
+ public function buildForm($form_id, FormStateInterface &$form_state);
/**
* Constructs a new $form from the information in $form_state.
@@ -249,8 +92,8 @@ interface FormBuilderInterface extends FormErrorInterface {
* @param string $form_id
* The unique string identifying the desired form. If a function with that
* name exists, it is called to build the form array.
- * @param array $form_state
- * A keyed array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param array|null $old_form
* (optional) A previously built $form. Used to retain the #build_id and
* #action properties in Ajax callbacks and similar partial form rebuilds.
@@ -266,17 +109,17 @@ interface FormBuilderInterface extends FormErrorInterface {
* @see self::processForm()
* @see \Drupal\system\FormAjaxController::content()
*/
- public function rebuildForm($form_id, &$form_state, $old_form = NULL);
+ public function rebuildForm($form_id, FormStateInterface &$form_state, $old_form = NULL);
/**
* Fetches a form from the cache.
*/
- public function getCache($form_build_id, &$form_state);
+ public function getCache($form_build_id, FormStateInterface &$form_state);
/**
* Stores a form in the cache.
*/
- public function setCache($form_build_id, $form, $form_state);
+ public function setCache($form_build_id, $form, FormStateInterface $form_state);
/**
* Retrieves, populates, and processes a form.
@@ -293,8 +136,8 @@ interface FormBuilderInterface extends FormErrorInterface {
* the desired form. If $form_arg is a string and a function with that
* name exists, it is called to build the form array.
* @param $form_state
- * A keyed array containing the current state of the form. Most important is
- * the $form_state['values'] collection, a tree of data used to simulate the
+ * The current state of the form. Most important is the
+ * $form_state['values'] collection, a tree of data used to simulate the
* incoming \Drupal::request()->request information from a user's form
* submission. If a key is not filled in $form_state['values'], then the
* default value of the respective element is used. To submit an unchecked
@@ -310,7 +153,7 @@ interface FormBuilderInterface extends FormErrorInterface {
* $form_state build info array so that the reference can be preserved. For
* example, a form builder function with the following signature:
* @code
- * function mymodule_form($form, &$form_state, &$object) {
+ * function mymodule_form($form, FormStateInterface &$form_state, &$object) {
* }
* @endcode
* would be called via self::submitForm() as follows:
@@ -322,7 +165,7 @@ interface FormBuilderInterface extends FormErrorInterface {
* For example:
* @code
* // register a new user
- * $form_state = array();
+ * $form_state = new FormState();
* $form_state['values']['name'] = 'robo-user';
* $form_state['values']['mail'] = 'robouser@example.com';
* $form_state['values']['pass']['pass1'] = 'password';
@@ -331,7 +174,7 @@ interface FormBuilderInterface extends FormErrorInterface {
* drupal_form_submit('user_register_form', $form_state);
* @endcode
*/
- public function submitForm($form_arg, &$form_state);
+ public function submitForm($form_arg, FormStateInterface &$form_state);
/**
* Retrieves the structured array that defines a given form.
@@ -339,14 +182,14 @@ interface FormBuilderInterface extends FormErrorInterface {
* @param string $form_id
* The unique string identifying the desired form. If a function
* with that name exists, it is called to build the form array.
- * @param array $form_state
- * A keyed array containing the current state of the form, including the
- * additional arguments to self::getForm() or self::submitForm() in the
- * 'args' component of the array.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form, including the additional arguments to
+ * self::getForm() or self::submitForm() in the 'args' component of the
+ * array.
*
* @return mixed|\Symfony\Component\HttpFoundation\Response
*/
- public function retrieveForm($form_id, &$form_state);
+ public function retrieveForm($form_id, FormStateInterface &$form_state);
/**
* Processes a form submission.
@@ -358,16 +201,15 @@ interface FormBuilderInterface extends FormErrorInterface {
* The unique string identifying the current form.
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * A keyed array containing the current state of the form. This
- * includes the current persistent storage data for the form, and
- * any data passed along by earlier steps when displaying a
- * multi-step form. Additional information, like the sanitized
- * \Drupal::request()->request data, is also accumulated here.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form. This includes the current persistent
+ * storage data for the form, and any data passed along by earlier steps
+ * when displaying a multi-step form. Additional information, like the
+ * sanitized \Drupal::request()->request data, is also accumulated here.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|null
*/
- public function processForm($form_id, &$form, &$form_state);
+ public function processForm($form_id, &$form, FormStateInterface &$form_state);
/**
* Prepares a structured form array.
@@ -380,11 +222,11 @@ interface FormBuilderInterface extends FormErrorInterface {
* theming, and hook_form_alter functions.
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * A keyed array containing the current state of the form. Passed
- * in here so that hook_form_alter() calls can use it, as well.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form. Passed in here so that hook_form_alter()
+ * calls can use it, as well.
*/
- public function prepareForm($form_id, &$form, &$form_state);
+ public function prepareForm($form_id, &$form, FormStateInterface &$form_state);
/**
* Builds and processes all elements in the structured form array.
@@ -473,15 +315,14 @@ interface FormBuilderInterface extends FormErrorInterface {
* theming, and hook_form_alter functions.
* @param array $element
* An associative array containing the structure of the current element.
- * @param array $form_state
- * A keyed array containing the current state of the form. In this
- * context, it is used to accumulate information about which button
- * was clicked when the form was submitted, as well as the sanitized
- * \Drupal::request()->request data.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form. In this context, it is used to accumulate
+ * information about which button was clicked when the form was submitted,
+ * as well as the sanitized \Drupal::request()->request data.
*
* @return array
*/
- public function doBuildForm($form_id, &$element, &$form_state);
+ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state);
/**
* Changes submitted form values during form validation.
@@ -508,8 +349,8 @@ interface FormBuilderInterface extends FormErrorInterface {
* @param $value
* The new value for the form element.
* @param $form_state
- * Form state array where the value change should be recorded.
+ * The current state of the form where the value change should be recorded.
*/
- public function setValue($element, $value, &$form_state);
+ public function setValue($element, $value, FormStateInterface &$form_state);
}
diff --git a/core/lib/Drupal/Core/Form/FormErrorInterface.php b/core/lib/Drupal/Core/Form/FormErrorInterface.php
index 43d0c5a..825ff49 100644
--- a/core/lib/Drupal/Core/Form/FormErrorInterface.php
+++ b/core/lib/Drupal/Core/Form/FormErrorInterface.php
@@ -9,6 +9,9 @@ namespace Drupal\Core\Form;
/**
* Provides an interface for form error handling.
+ *
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
+ * Use \Drupal\Core\Form\FormStateInterface directly.
*/
interface FormErrorInterface {
@@ -99,8 +102,8 @@ interface FormErrorInterface {
* 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'.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param string $message
* (optional) The error message to present to the user.
*
@@ -108,26 +111,26 @@ interface FormErrorInterface {
* Return value is for internal use only. To get a list of errors, use
* FormErrorInterface::getErrors() or FormErrorInterface::getError().
*/
- public function setErrorByName($name, array &$form_state, $message = '');
+ public function setErrorByName($name, FormStateInterface &$form_state, $message = '');
/**
* Clears all errors against all form elements made by FormErrorInterface::setErrorByName().
*
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function clearErrors(array &$form_state);
+ public function clearErrors(FormStateInterface &$form_state);
/**
* Returns an associative array of all errors.
*
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* An array of all errors, keyed by the name of the form element.
*/
- public function getErrors(array $form_state);
+ public function getErrors(FormStateInterface &$form_state);
/**
* Returns the error message filed against the given form element.
@@ -137,18 +140,18 @@ interface FormErrorInterface {
*
* @param array $element
* The form element to check for errors.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return string|null
* Either the error message for this element or NULL if there are no errors.
*/
- public function getError($element, array &$form_state);
+ public function getError($element, FormStateInterface &$form_state);
/**
* Flags an element as having an error.
*/
- public function setError(&$element, array &$form_state, $message = '');
+ public function setError(&$element, FormStateInterface &$form_state, $message = '');
/**
* Returns if there have been any errors during build.
diff --git a/core/lib/Drupal/Core/Form/FormInterface.php b/core/lib/Drupal/Core/Form/FormInterface.php
index 40daf12..00c686e 100644
--- a/core/lib/Drupal/Core/Form/FormInterface.php
+++ b/core/lib/Drupal/Core/Form/FormInterface.php
@@ -27,32 +27,32 @@ interface FormInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* The form structure.
*/
- public function buildForm(array $form, array &$form_state);
+ public function buildForm(array $form, FormStateInterface $form_state);
/**
* Form validation handler.
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function validateForm(array &$form, array &$form_state);
+ public function validateForm(array &$form, FormStateInterface $form_state);
/**
* Form submission handler.
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function submitForm(array &$form, array &$form_state);
+ public function submitForm(array &$form, FormStateInterface $form_state);
}
diff --git a/core/lib/Drupal/Core/Form/FormState.php b/core/lib/Drupal/Core/Form/FormState.php
new file mode 100644
index 0000000..b0a21db
--- /dev/null
+++ b/core/lib/Drupal/Core/Form/FormState.php
@@ -0,0 +1,748 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Form\FormState.
+ */
+
+namespace Drupal\Core\Form;
+
+use Drupal\Core\Url;
+
+/**
+ * Stores information about the state of a form.
+ *
+ * @todo Remove usage of \ArrayAccess in https://www.drupal.org/node/2310255.
+ */
+class FormState implements FormStateInterface, \ArrayAccess {
+
+ /**
+ * Tracks if any errors have been set on any form.
+ *
+ * @var bool
+ */
+ protected static $anyErrors = FALSE;
+
+ /**
+ * The internal storage of the form state.
+ *
+ * @var array
+ */
+ protected $internalStorage = array();
+
+ /**
+ * The complete form structure.
+ *
+ * #process, #after_build, #element_validate, and other handlers being invoked
+ * on a form element may use this reference to access other information in the
+ * form the element is contained in.
+ *
+ * @see self::getCompleteForm()
+ *
+ * This property is uncacheable.
+ *
+ * @var array
+ */
+ protected $complete_form;
+
+ /**
+ * An associative array of information stored by Form API that is necessary to
+ * build and rebuild the form from cache when the original context may no
+ * longer be available:
+ * - callback: The actual callback to be used to retrieve the form array.
+ * Can be any callable. If none is provided $form_id is used as the name
+ * of a function to call instead.
+ * - args: A list of arguments to pass to the form constructor.
+ * - files: An optional array defining include files that need to be loaded
+ * for building the form. Each array entry may be the path to a file or
+ * another array containing values for the parameters 'type', 'module' and
+ * 'name' as needed by module_load_include(). The files listed here are
+ * automatically loaded by form_get_cache(). By default the current menu
+ * router item's 'file' definition is added, if any. Use
+ * form_load_include() to add include files from a form constructor.
+ * - form_id: Identification of the primary form being constructed and
+ * processed.
+ * - base_form_id: Identification for a base form, as declared in the form
+ * class's \Drupal\Core\Form\BaseFormIdInterface::getBaseFormId() method.
+ *
+ * @var array
+ */
+ protected $build_info = array(
+ 'args' => array(),
+ 'files' => array(),
+ );
+
+ /**
+ * Similar to self::$build_info, but pertaining to
+ * \Drupal\Core\Form\FormBuilderInterface::rebuildForm().
+ *
+ * This property is uncacheable.
+ *
+ * @var array
+ */
+ protected $rebuild_info = array();
+
+ /**
+ * Normally, after the entire form processing is completed and submit handlers
+ * have run, a form is considered to be done and
+ * \Drupal\Core\Form\FormSubmitterInterface::redirectForm() will redirect the
+ * user to a new page using a GET request (so a browser refresh does not
+ * re-submit the form). However, if 'rebuild' has been set to TRUE, then a new
+ * copy of the form is immediately built and sent to the browser, instead of a
+ * redirect. This is used for multi-step forms, such as wizards and
+ * confirmation forms. Normally, $form_state['rebuild'] is set by a submit
+ * handler, since its is usually logic within a submit handler that determines
+ * whether a form is done or requires another step. However, a validation
+ * handler may already set $form_state['rebuild'] to cause the form processing
+ * to bypass submit handlers and rebuild the form instead, even if there are
+ * no validation errors.
+ *
+ * This property is uncacheable.
+ *
+ * @see self::setRebuild()
+ *
+ * @var bool
+ */
+ protected $rebuild = FALSE;
+
+ /**
+ * Used when a form needs to return some kind of a
+ * \Symfony\Component\HttpFoundation\Response object, e.g., a
+ * \Symfony\Component\HttpFoundation\BinaryFileResponse when triggering a
+ * file download. If you use the $form_state['redirect'] key, it will be used
+ * to build a \Symfony\Component\HttpFoundation\RedirectResponse and will
+ * populate this key.
+ *
+ * @var \Symfony\Component\HttpFoundation\Response|null
+ */
+ protected $response;
+
+ /**
+ * Used to redirect the form on submission. It may either be a string
+ * containing the destination URL, or an array of arguments compatible with
+ * url(). See url() for complete information.
+ *
+ * This property is uncacheable.
+ *
+ * @var string|array|null
+ */
+ protected $redirect;
+
+ /**
+ * Used for route-based redirects.
+ *
+ * This property is uncacheable.
+ *
+ * @var \Drupal\Core\Url|array
+ */
+ protected $redirect_route;
+
+ /**
+ * If set to TRUE the form will NOT perform a redirect, even if
+ * self::$redirect is set.
+ *
+ * This property is uncacheable.
+ *
+ * @var bool
+ */
+ protected $no_redirect;
+
+ /**
+ * The HTTP form method to use for finding the input for this form.
+ *
+ * May be 'post' or 'get'. Defaults to 'post'. Note that 'get' method forms do
+ * not use form ids so are always considered to be submitted, which can have
+ * unexpected effects. The 'get' method should only be used on forms that do
+ * not change data, as that is exclusively the domain of 'post.'
+ *
+ * This property is uncacheable.
+ *
+ * @var string
+ */
+ protected $method = 'post';
+
+ /**
+ * If set to TRUE the original, unprocessed form structure will be cached,
+ * which allows the entire form to be rebuilt from cache. A typical form
+ * workflow involves two page requests; first, a form is built and rendered
+ * for the user to fill in. Then, the user fills the form in and submits it,
+ * triggering a second page request in which the form must be built and
+ * processed. By default, $form and $form_state are built from scratch during
+ * each of these page requests. Often, it is necessary or desired to persist
+ * the $form and $form_state variables from the initial page request to the
+ * one that processes the submission. 'cache' can be set to TRUE to do this.
+ * A prominent example is an Ajax-enabled form, in which ajax_process_form()
+ * enables form caching for all forms that include an element with the #ajax
+ * property. (The Ajax handler has no way to build the form itself, so must
+ * rely on the cached version.) Note that the persistence of $form and
+ * $form_state happens automatically for (multi-step) forms having the
+ * self::$rebuild flag set, regardless of the value for self::$cache.
+ *
+ * @var bool
+ */
+ protected $cache = FALSE;
+
+ /**
+ * If set to TRUE the form will NOT be cached, even if 'cache' is set.
+ *
+ * @var bool
+ */
+ protected $no_cache;
+
+ /**
+ * An associative array of values submitted to the form.
+ *
+ * The validation functions and submit functions use this array for nearly all
+ * their decision making. (Note that #tree determines whether the values are a
+ * flat array or an array whose structure parallels the $form array. See the
+ * @link forms_api_reference.html Form API reference @endlink for more
+ * information.)
+ *
+ * This property is uncacheable.
+ *
+ * @var array
+ */
+ protected $values;
+
+ /**
+ * The array of 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 the data in the 'values' array exclusively. The most common use of this
+ * key is for multi-step forms that need to clear some of the user input when
+ * setting 'rebuild'. The values correspond to \Drupal::request()->request or
+ * \Drupal::request()->query, depending on the 'method' chosen.
+ *
+ * This property is uncacheable.
+ *
+ * @var array
+ */
+ protected $input;
+
+ /**
+ * If TRUE and the method is GET, a form_id is not necessary.
+ *
+ * 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.
+ *
+ * This property is uncacheable.
+ *
+ * @var bool
+ */
+ protected $always_process;
+
+ /**
+ * Ordinarily, a form is only validated once, but there are times when a form
+ * is resubmitted internally and should be validated again. Setting this to
+ * TRUE will force that to happen. This is most likely to occur during Ajax
+ * operations.
+ *
+ * This property is uncacheable.
+ *
+ * @var bool
+ */
+ protected $must_validate;
+
+ /**
+ * If TRUE, the form was submitted programmatically, usually invoked via
+ * \Drupal\Core\Form\FormBuilderInterface::submitForm(). Defaults to FALSE.
+ *
+ * @var bool
+ */
+ protected $programmed = FALSE;
+
+ /**
+ * If TRUE, programmatic form submissions are processed without taking #access
+ * into account. Set this to FALSE when submitting a form programmatically
+ * with values that may have been input by the user executing the current
+ * request; this will cause #access to be respected as it would on a normal
+ * form submission. Defaults to TRUE.
+ *
+ * @var bool
+ */
+ protected $programmed_bypass_access_check = TRUE;
+
+ /**
+ * TRUE signifies correct form submission. This is always TRUE for programmed
+ * forms coming from \Drupal\Core\Form\FormBuilderInterface::submitForm() (see
+ * 'programmed' key), or if the form_id coming from the
+ * \Drupal::request()->request data is set and matches the current form_id.
+ *
+ * @var bool
+ */
+ protected $process_input;
+
+ /**
+ * If TRUE, the form has been submitted. Defaults to FALSE.
+ *
+ * This property is uncacheable.
+ *
+ * @var bool
+ */
+ protected $submitted = FALSE;
+
+ /**
+ * If TRUE, the form was submitted and has been processed and executed.
+ *
+ * This property is uncacheable.
+ *
+ * @var bool
+ */
+ protected $executed = FALSE;
+
+ /**
+ * The form element that triggered submission, which may or may not be a
+ * button (in the case of Ajax forms). This key is often used to distinguish
+ * between various buttons in a submit handler, and is also used in Ajax
+ * handlers.
+ *
+ * This property is uncacheable.
+ *
+ * @var array|null
+ */
+ protected $triggering_element;
+
+ /**
+ * If TRUE, there is a file element and Form API will set the appropriate
+ * 'enctype' HTML attribute on the form.
+ *
+ * @var bool
+ */
+ protected $has_file_element;
+
+ /**
+ * Contains references to details elements to render them within vertical tabs.
+ *
+ * This property is uncacheable.
+ *
+ * @var array
+ */
+ protected $groups = array();
+
+ /**
+ * This is not a special key, and no specific support is provided for it in
+ * the Form API. By tradition it was the location where application-specific
+ * data was stored for communication between the submit, validation, and form
+ * builder functions, especially in a multi-step-style form. Form
+ * implementations may use any key(s) within $form_state (other than the keys
+ * listed here and other reserved ones used by Form API internals) for this
+ * kind of storage. The recommended way to ensure that the chosen key doesn't
+ * conflict with ones used by the Form API or other modules is to use the
+ * module name as the key name or a prefix for the key name. For example, the
+ * entity form classes use $this->entity in entity forms, or
+ * $form_state['controller']->getEntity() outside the controller, to store
+ * information about the entity being edited, and this information stays
+ * available across successive clicks of the "Preview" button (if available)
+ * as well as when the "Save" button is finally clicked.
+ *
+ * @var array
+ */
+ protected $storage = array();
+
+ /**
+ * A list containing copies of all submit and button elements in the form.
+ *
+ * This property is uncacheable.
+ *
+ * @var array
+ */
+ protected $buttons = array();
+
+ /**
+ * Holds temporary data accessible during the current page request only.
+ *
+ * All $form_state properties that are not reserved keys (see
+ * other properties marked as uncacheable) persist throughout a multistep form
+ * sequence. Form API provides this key for modules to communicate information
+ * across form-related functions during a single page request. It may be used
+ * to temporarily save data that does not need to or should not be cached
+ * during the whole form workflow; e.g., data that needs to be accessed during
+ * the current form build process only. There is no use-case for this
+ * functionality in Drupal core.
+ *
+ * This property is uncacheable.
+ *
+ * @var array
+ */
+ protected $temporary;
+
+ /**
+ * Tracks if the form has finished validation.
+ *
+ * This property is uncacheable.
+ *
+ * @var bool
+ */
+ protected $validation_complete = FALSE;
+
+ /**
+ * Contains errors for this form.
+ *
+ * This property is uncacheable.
+ *
+ * @var array
+ */
+ protected $errors = array();
+
+ /**
+ * Stores which errors should be limited during validation.
+ *
+ * This property is uncacheable.
+ *
+ * @var array|null
+ */
+ protected $limit_validation_errors;
+
+ /**
+ * Stores the gathered validation handlers.
+ *
+ * This property is uncacheable.
+ *
+ * @var array|null
+ */
+ protected $validate_handlers;
+
+ /**
+ * Stores the gathered submission handlers.
+ *
+ * This property is uncacheable.
+ *
+ * @var array|null
+ */
+ protected $submit_handlers;
+
+ /**
+ * Constructs a \Drupal\Core\Form\FormState object.
+ *
+ * @param array $form_state_additions
+ * (optional) An associative array used to build the current state of the
+ * form. Use this to pass additional information to the form, such as the
+ * langcode. Defaults to an empty array.
+ */
+ public function __construct(array $form_state_additions = array()) {
+ $this->setFormState($form_state_additions);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setFormState(array $form_state_additions) {
+ foreach ($form_state_additions as $key => $value) {
+ $this->set($key, $value);
+ }
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCacheableArray($allowed_keys = array()) {
+ $cacheable_array = array(
+ 'build_info' => $this->build_info,
+ 'response' => $this->response,
+ 'cache' => $this->cache,
+ 'no_cache' => $this->no_cache,
+ 'programmed' => $this->programmed,
+ 'programmed_bypass_access_check' => $this->programmed_bypass_access_check,
+ 'process_input' => $this->process_input,
+ 'has_file_element' => $this->has_file_element,
+ 'storage' => $this->storage,
+ ) + $this->internalStorage;
+ foreach ($allowed_keys as $allowed_key) {
+ $cacheable_array[$allowed_key] = $this->get($allowed_key);
+ }
+ return $cacheable_array;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setCompleteForm(array &$complete_form) {
+ $this->complete_form = &$complete_form;
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function &getCompleteForm() {
+ return $this->complete_form;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function offsetExists($offset) {
+ return isset($this->{$offset}) || isset($this->internalStorage[$offset]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function &offsetGet($offset) {
+ $value = &$this->get($offset);
+ return $value;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function offsetSet($offset, $value) {
+ $this->set($offset, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function offsetUnset($offset) {
+ if (property_exists($this, $offset)) {
+ $this->{$offset} = NULL;
+ }
+ unset($this->internalStorage[$offset]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setIfNotExists($property, $value) {
+ if (!$this->has($property)) {
+ $this->set($property, $value);
+ }
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function &get($property) {
+ if (property_exists($this, $property)) {
+ return $this->{$property};
+ }
+ else {
+ if (!isset($this->internalStorage[$property])) {
+ $this->internalStorage[$property] = NULL;
+ }
+ return $this->internalStorage[$property];
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set($property, $value) {
+ if (property_exists($this, $property)) {
+ $this->{$property} = $value;
+ }
+ else {
+ $this->internalStorage[$property] = $value;
+ }
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function has($property) {
+ if (property_exists($this, $property)) {
+ return $this->{$property} !== NULL;
+ }
+
+ return array_key_exists($property, $this->internalStorage);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function addBuildInfo($property, $value) {
+ $build_info = $this->get('build_info');
+ $build_info[$property] = $value;
+ $this->set('build_info', $build_info);
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getValues() {
+ return $this->values;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function addValue($property, $value) {
+ $values = $this->getValues();
+ $values[$property] = $value;
+ $this->set('values', $values);
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setRedirect(Url $url) {
+ $this->set('redirect_route', $url);
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getRedirect() {
+ // Skip redirection for form submissions invoked via
+ // \Drupal\Core\Form\FormBuilderInterface::submitForm().
+ if ($this->get('programmed')) {
+ return FALSE;
+ }
+ // Skip redirection if rebuild is activated.
+ if ($this->get('rebuild')) {
+ return FALSE;
+ }
+ // Skip redirection if it was explicitly disallowed.
+ if ($this->get('no_redirect')) {
+ return FALSE;
+ }
+
+ // Check for a route-based redirection.
+ if ($redirect_route = $this->get('redirect_route')) {
+ // @todo Remove once all redirects are converted to \Drupal\Core\Url. See
+ // https://www.drupal.org/node/2189661.
+ if (!($redirect_route instanceof Url)) {
+ $redirect_route += array(
+ 'route_parameters' => array(),
+ 'options' => array(),
+ );
+ $redirect_route = new Url($redirect_route['route_name'], $redirect_route['route_parameters'], $redirect_route['options']);
+ }
+
+ $redirect_route->setAbsolute();
+ return $redirect_route;
+ }
+
+ return $this->get('redirect');
+ }
+
+ /**
+ * Sets the global status of errors.
+ *
+ * @param bool $errors
+ * TRUE if any form has any errors, FALSE otherwise.
+ */
+ protected static function setAnyErrors($errors = TRUE) {
+ static::$anyErrors = $errors;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function hasAnyErrors() {
+ return static::$anyErrors;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setErrorByName($name, $message = '') {
+ if ($this->get('validation_complete')) {
+ throw new \LogicException('Form errors cannot be set after form validation has finished.');
+ }
+
+ $errors = $this->getErrors();
+ if (!isset($errors[$name])) {
+ $record = TRUE;
+ $limit_validation_errors = $this->get('limit_validation_errors');
+ if ($limit_validation_errors !== NULL) {
+ // #limit_validation_errors is an array of "sections" within which user
+ // input must be valid. If the element is within one of these sections,
+ // the error must be recorded. Otherwise, it can be suppressed.
+ // #limit_validation_errors can be an empty array, in which case all
+ // errors are suppressed. For example, a "Previous" button might want
+ // its submit action to be triggered even if none of the submitted
+ // values are valid.
+ $record = FALSE;
+ foreach ($limit_validation_errors as $section) {
+ // Exploding by '][' reconstructs the element's #parents. If the
+ // reconstructed #parents begin with the same keys as the specified
+ // section, then the element's values are within the part of
+ // $form_state['values'] that the clicked button requires to be valid,
+ // so errors for this element must be recorded. As the exploded array
+ // will all be strings, we need to cast every value of the section
+ // array to string.
+ if (array_slice(explode('][', $name), 0, count($section)) === array_map('strval', $section)) {
+ $record = TRUE;
+ break;
+ }
+ }
+ }
+ if ($record) {
+ $errors[$name] = $message;
+ $this->set('errors', $errors);
+ static::setAnyErrors();
+ if ($message) {
+ $this->drupalSetMessage($message, 'error');
+ }
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setError(&$element, $message = '') {
+ $this->setErrorByName(implode('][', $element['#parents']), $message);
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function clearErrors() {
+ $this->set('errors', array());
+ static::setAnyErrors(FALSE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getError($element) {
+ if ($errors = $this->getErrors($this)) {
+ $parents = array();
+ foreach ($element['#parents'] as $parent) {
+ $parents[] = $parent;
+ $key = implode('][', $parents);
+ if (isset($errors[$key])) {
+ return $errors[$key];
+ }
+ }
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getErrors() {
+ return $this->get('errors');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setRebuild($rebuild = TRUE) {
+ $this->set('rebuild', $rebuild);
+ return $this;
+ }
+
+ /**
+ * Wraps drupal_set_message().
+ *
+ * @return array|null
+ */
+ protected function drupalSetMessage($message = NULL, $type = 'status', $repeat = FALSE) {
+ return drupal_set_message($message, $type, $repeat);
+ }
+
+}
diff --git a/core/lib/Drupal/Core/Form/FormStateInterface.php b/core/lib/Drupal/Core/Form/FormStateInterface.php
new file mode 100644
index 0000000..24ceb52
--- /dev/null
+++ b/core/lib/Drupal/Core/Form/FormStateInterface.php
@@ -0,0 +1,314 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Form\FormStateInterface.
+ */
+
+namespace Drupal\Core\Form;
+
+use Drupal\Core\Url;
+
+/**
+ * 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
+ * \Drupal\Core\Form\FormState::$internalStorage for documentation of the
+ * available flags.
+ *
+ * @see \Drupal\Core\Form\FormBuilderInterface
+ * @see \Drupal\Core\Form\FormValidatorInterface
+ * @see \Drupal\Core\Form\FormSubmitterInterface
+ */
+interface FormStateInterface {
+
+ /**
+ * Returns a reference to the complete form array.
+ *
+ * @return array
+ * The complete form array.
+ */
+ public function &getCompleteForm();
+
+ /**
+ * Stores the complete form array.
+ *
+ * @param array $complete_form
+ * The complete form array.
+ *
+ * @return $this
+ */
+ public function setCompleteForm(array &$complete_form);
+
+ /**
+ * Returns an array representation of the cacheable portion of the form state.
+ *
+ * @return array
+ * The cacheable portion of the form state.
+ */
+ public function getCacheableArray();
+
+ /**
+ * Sets the value of the form state.
+ *
+ * @param array $form_state_additions
+ * An array of values to add to the form state.
+ *
+ * @return $this
+ */
+ public function setFormState(array $form_state_additions);
+
+ /**
+ * Sets a value to an arbitrary property if it does not exist yet.
+ *
+ * @param string $property
+ * The property to use for the value.
+ * @param mixed $value
+ * The data to store.
+ *
+ * @return $this
+ */
+ public function setIfNotExists($property, $value);
+
+ /**
+ * Sets the redirect URL for the form.
+ *
+ * @param \Drupal\Core\Url $url
+ * The URL to redirect to.
+ *
+ * @return $this
+ *
+ * @see \Drupal\Core\Form\FormSubmitterInterface::redirectForm()
+ */
+ public function setRedirect(Url $url);
+
+ /**
+ * Gets the value to use for redirecting after the form has been executed.
+ *
+ * @see \Drupal\Core\Form\FormSubmitterInterface::redirectForm()
+ *
+ * @return mixed
+ * The value will be one of the following:
+ * - A fully prepared \Symfony\Component\HttpFoundation\RedirectResponse.
+ * - An instance of \Drupal\Core\Url to use for the redirect.
+ * - A numerically-indexed array where the first value is the path to use
+ * for the redirect, and the optional second value is an array of options
+ * for generating the URL from the path.
+ * - The path 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.
+ */
+ public function getRedirect();
+
+ /**
+ * Gets any arbitrary property.
+ *
+ * @param string $property
+ * The property to retrieve.
+ *
+ * @return mixed
+ * A reference to the value for that property, or NULL if the property does
+ * not exist.
+ */
+ public function &get($property);
+
+ /**
+ * Sets a value to an arbitrary property.
+ *
+ * @param string $property
+ * The property to use for the value.
+ * @param mixed $value
+ * The value to set.
+ *
+ * @return $this
+ */
+ public function set($property, $value);
+
+ /**
+ * @param string $property
+ * The property to use for the value.
+ */
+ public function has($property);
+
+ /**
+ * Adds a value to the build info.
+ *
+ * @param string $property
+ * The property to use for the value.
+ * @param mixed $value
+ * The value to set.
+ *
+ * @return $this
+ */
+ public function addBuildInfo($property, $value);
+
+ /**
+ * Returns the submitted and sanitized form values.
+ *
+ * @return array
+ * An associative array of values submitted to the form.
+ */
+ public function getValues();
+
+ /**
+ * {@inheritdoc}
+ */
+ public function addValue($property, $value);
+
+ /**
+ * Determines if any forms have any errors.
+ *
+ * @return bool
+ * TRUE if any form has any errors, FALSE otherwise.
+ */
+ public static function hasAnyErrors();
+
+ /**
+ * 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['values'] that must contain valid values. Each "section" is an
+ * array with the ordered set of keys needed to reach that part of
+ * $form_state['values'] (i.e., the #parents property of the element).
+ *
+ * Example 1: Allow the "Previous" button to function, regardless of whether
+ * any user input is valid.
+ *
+ * @code
+ * $form['actions']['previous'] = array(
+ * '#type' => 'submit',
+ * '#value' => t('Previous'),
+ * '#limit_validation_errors' => array(), // No validation.
+ * '#submit' => array('some_submit_function'), // #submit required.
+ * );
+ * @endcode
+ *
+ * Example 2: Require some, but not all, user input to be valid to process the
+ * submission of a "Previous" button.
+ *
+ * @code
+ * $form['actions']['previous'] = array(
+ * '#type' => 'submit',
+ * '#value' => t('Previous'),
+ * '#limit_validation_errors' => array(
+ * array('step1'), // Validate $form_state['values']['step1'].
+ * array('foo', 'bar'), // Validate $form_state['values']['foo']['bar'].
+ * ),
+ * '#submit' => array('some_submit_function'), // #submit required.
+ * );
+ * @endcode
+ *
+ * This will require $form_state['values']['step1'] and everything within it
+ * (for example, $form_state['values']['step1']['choice']) to be valid, so
+ * calls to FormErrorInterface::setErrorByName('step1', $form_state, $message)
+ * or
+ * FormErrorInterface::setErrorByName('step1][choice', $form_state, $message)
+ * will prevent the submit handlers from running, and result in the error
+ * message being displayed to the user. However, calls to
+ * FormErrorInterface::setErrorByName('step2', $form_state, $message) and
+ * FormErrorInterface::setErrorByName('step2][groupX][choiceY', $form_state, $message)
+ * will be suppressed, resulting in the message not being displayed to the
+ * user, and the submit handlers will run despite
+ * $form_state['values']['step2'] and
+ * $form_state['values']['step2']['groupX']['choiceY'] containing invalid
+ * values. Errors for an invalid $form_state['values']['foo'] will be
+ * suppressed, but errors flagging invalid values for
+ * $form_state['values']['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['values'], 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.
+ *
+ * @param string $name
+ * The 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'.
+ * @param string $message
+ * (optional) The error message to present to the user.
+ *
+ * @return $this
+ */
+ public function setErrorByName($name, $message = '');
+
+ /**
+ * Flags an element as having an error.
+ *
+ * @param array $element
+ * The form element.
+ * @param string $message
+ * (optional) The error message to present to the user.
+ *
+ * @return $this
+ */
+ public function setError(&$element, $message = '');
+
+ /**
+ * Clears all errors against all form elements made by FormErrorInterface::setErrorByName().
+ */
+ public function clearErrors();
+
+ /**
+ * Returns an associative array of all errors.
+ *
+ * @return array
+ * An array of all errors, keyed by the name of the form element.
+ */
+ public function getErrors();
+
+ /**
+ * 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.
+ *
+ * @param array $element
+ * The form element to check for errors.
+ *
+ * @return string|null
+ * Either the error message for this element or NULL if there are no errors.
+ */
+ public function getError($element);
+
+ /**
+ * Sets the form to be rebuilt after processing.
+ *
+ * @param bool $rebuild
+ * (optional) Whether the form should be rebuilt or not. Defaults to TRUE.
+ *
+ * @return $this
+ */
+ public function setRebuild($rebuild = TRUE);
+
+}
diff --git a/core/lib/Drupal/Core/Form/FormSubmitter.php b/core/lib/Drupal/Core/Form/FormSubmitter.php
index 78aca72..4c5d1c7 100644
--- a/core/lib/Drupal/Core/Form/FormSubmitter.php
+++ b/core/lib/Drupal/Core/Form/FormSubmitter.php
@@ -47,7 +47,7 @@ class FormSubmitter implements FormSubmitterInterface {
/**
* {@inheritdoc}
*/
- public function doSubmitForm(&$form, &$form_state) {
+ public function doSubmitForm(&$form, FormStateInterface &$form_state) {
if (!$form_state['submitted']) {
return;
}
@@ -61,18 +61,7 @@ class FormSubmitter implements FormSubmitterInterface {
// \Drupal\Core\Form\FormBuilderInterface::submitForm).
if ($batch = &$this->batchGet() && !isset($batch['current_set'])) {
// Store $form_state information in the batch definition.
- // We need the full $form_state when either:
- // - Some submit handlers were saved to be called during batch
- // processing. See self::executeSubmitHandlers().
- // - The form is multistep.
- // In other cases, we only need the information expected by
- // self::redirectForm().
- if ($batch['has_form_submits'] || !empty($form_state['rebuild'])) {
- $batch['form_state'] = $form_state;
- }
- else {
- $batch['form_state'] = array_intersect_key($form_state, array_flip(array('programmed', 'rebuild', 'storage', 'no_redirect', 'redirect', 'redirect_route')));
- }
+ $batch['form_state'] = $form_state;
$batch['progressive'] = !$form_state['programmed'];
$response = batch_process();
@@ -103,13 +92,13 @@ class FormSubmitter implements FormSubmitterInterface {
/**
* {@inheritdoc}
*/
- public function executeSubmitHandlers(&$form, &$form_state) {
+ public function executeSubmitHandlers(&$form, FormStateInterface &$form_state) {
// If there was a button pressed, use its handlers.
- if (isset($form_state['submit_handlers'])) {
+ if (!empty($form_state['submit_handlers'])) {
$handlers = $form_state['submit_handlers'];
}
// Otherwise, check for a form-level handler.
- elseif (isset($form['#submit'])) {
+ elseif (!empty($form['#submit'])) {
$handlers = $form['#submit'];
}
else {
@@ -137,76 +126,53 @@ class FormSubmitter implements FormSubmitterInterface {
/**
* {@inheritdoc}
*/
- public function redirectForm($form_state) {
- // Skip redirection for form submissions invoked via
- // \Drupal\Core\Form\FormBuilderInterface::submitForm().
- if (!empty($form_state['programmed'])) {
- return;
- }
- // Skip redirection if rebuild is activated.
- if (!empty($form_state['rebuild'])) {
- return;
- }
- // Skip redirection if it was explicitly disallowed.
- if (!empty($form_state['no_redirect'])) {
- return;
- }
+ public function redirectForm(FormStateInterface $form_state) {
+ // According to RFC 7231, 303 See Other status code must be used to redirect
+ // user agent (and not default 302 Found).
+ // @see http://tools.ietf.org/html/rfc7231#section-6.4.4
+ $status_code = Response::HTTP_SEE_OTHER;
+ $redirect = $form_state->getRedirect();
// Allow using redirect responses directly if needed.
- if (isset($form_state['redirect']) && $form_state['redirect'] instanceof RedirectResponse) {
- return $form_state['redirect'];
+ if ($redirect instanceof RedirectResponse) {
+ return $redirect;
}
+ $url = NULL;
// Check for a route-based redirection.
- if (isset($form_state['redirect_route'])) {
- // @todo Remove once all redirects are converted to Url.
- if (!($form_state['redirect_route'] instanceof Url)) {
- $form_state['redirect_route'] += array(
- 'route_parameters' => array(),
- 'options' => array(),
- );
- $form_state['redirect_route'] = new Url($form_state['redirect_route']['route_name'], $form_state['redirect_route']['route_parameters'], $form_state['redirect_route']['options']);
+ if ($redirect instanceof Url) {
+ $url = $redirect->toString();
+ }
+ // An array contains the path to use for the redirect, as well as options to
+ // use for generating the URL.
+ elseif (is_array($redirect)) {
+ if (isset($redirect[1])) {
+ $options = $redirect[1];
}
-
- $form_state['redirect_route']->setAbsolute();
- // According to RFC 7231, 303 See Other status code must be used
- // to redirect user agent (and not default 302 Found).
- // @see http://tools.ietf.org/html/rfc7231#section-6.4.4
- return new RedirectResponse($form_state['redirect_route']->toString(), Response::HTTP_SEE_OTHER);
+ else {
+ $options = array();
+ }
+ // Redirections should always use absolute URLs.
+ $options['absolute'] = TRUE;
+ if (isset($redirect[2])) {
+ $status_code = $redirect[2];
+ }
+ $url = $this->urlGenerator->generateFromPath($redirect[0], $options);
}
-
- // Only invoke a redirection if redirect value was not set to FALSE.
- if (!isset($form_state['redirect']) || $form_state['redirect'] !== FALSE) {
- if (isset($form_state['redirect'])) {
- if (is_array($form_state['redirect'])) {
- if (isset($form_state['redirect'][1])) {
- $options = $form_state['redirect'][1];
- }
- else {
- $options = array();
- }
- // Redirections should always use absolute URLs.
- $options['absolute'] = TRUE;
- if (isset($form_state['redirect'][2])) {
- $status_code = $form_state['redirect'][2];
- }
- else {
- $status_code = Response::HTTP_SEE_OTHER;
- }
- return new RedirectResponse($this->urlGenerator->generateFromPath($form_state['redirect'][0], $options), $status_code);
- }
- else {
- // This function can be called from the installer, which guarantees
- // that $redirect will always be a string, so catch that case here
- // and use the appropriate redirect function.
- if ($this->drupalInstallationAttempted()) {
- install_goto($form_state['redirect']);
- }
- else {
- return new RedirectResponse($this->urlGenerator->generateFromPath($form_state['redirect'], array('absolute' => TRUE)), Response::HTTP_SEE_OTHER);
- }
- }
+ // A string represents the path to use for the redirect.
+ elseif (is_string($redirect)) {
+ // This function can be called from the installer, which guarantees
+ // that $redirect will always be a string, so catch that case here
+ // and use the appropriate redirect function.
+ if ($this->drupalInstallationAttempted()) {
+ install_goto($redirect);
}
+ else {
+ $url = $this->urlGenerator->generateFromPath($redirect, array('absolute' => TRUE));
+ }
+ }
+ // If no redirect was specified, redirect to the current path.
+ elseif ($redirect === NULL) {
$request = $this->requestStack->getCurrentRequest();
// @todo Remove dependency on the internal _system_path attribute:
// https://www.drupal.org/node/2293521.
@@ -214,7 +180,10 @@ class FormSubmitter implements FormSubmitterInterface {
'query' => $request->query->all(),
'absolute' => TRUE,
));
- return new RedirectResponse($url, Response::HTTP_SEE_OTHER);
+ }
+
+ if ($url) {
+ return new RedirectResponse($url, $status_code);
}
}
diff --git a/core/lib/Drupal/Core/Form/FormSubmitterInterface.php b/core/lib/Drupal/Core/Form/FormSubmitterInterface.php
index 8ae8b08..8a79fe0 100644
--- a/core/lib/Drupal/Core/Form/FormSubmitterInterface.php
+++ b/core/lib/Drupal/Core/Form/FormSubmitterInterface.php
@@ -17,14 +17,14 @@ interface FormSubmitterInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return null|\Symfony\Component\HttpFoundation\Response
* If a response was set by a submit handler, or if the form needs to
* redirect, a Response object will be returned.
*/
- public function doSubmitForm(&$form, &$form_state);
+ public function doSubmitForm(&$form, FormStateInterface &$form_state);
/**
* Executes custom submission handlers for a given form.
@@ -35,18 +35,18 @@ interface FormSubmitterInterface {
* @param $form
* An associative array containing the structure of the form.
* @param $form_state
- * A keyed array containing the current state of the form. If the user
- * submitted the form by clicking a button with custom handler functions
- * defined, those handlers will be stored here.
+ * The current state of the form. If the user submitted the form by clicking
+ * a button with custom handler functions defined, those handlers will be
+ * stored here.
*/
- public function executeSubmitHandlers(&$form, &$form_state);
+ public function executeSubmitHandlers(&$form, FormStateInterface &$form_state);
/**
* Redirects the user to a URL after a form has been processed.
*
* After a form is submitted and processed, normally the user should be
* redirected to a new destination page. This function figures out what that
- * destination should be, based on the $form_state array and the 'destination'
+ * destination should be, based on the $form_state and the 'destination'
* query string in the request URL, and redirects the user there.
*
* Usually (for exceptions, see below) $form_state['redirect'] determines
@@ -58,11 +58,11 @@ interface FormSubmitterInterface {
*
* Here is an example of how to set up a form to redirect to the path 'node':
* @code
- * $form_state['redirect'] = 'node';
+ * $form_state->set('redirect', 'node');
* @endcode
* And here is an example of how to redirect to 'node/123?foo=bar#baz':
* @code
- * $form_state['redirect'] = array(
+ * $form_state->set('redirect', array(
* 'node/123',
* array(
* 'query' => array(
@@ -70,7 +70,7 @@ interface FormSubmitterInterface {
* ),
* 'fragment' => 'baz',
* ),
- * );
+ * ));
* @endcode
*
* There are several exceptions to the "usual" behavior described above:
@@ -94,13 +94,13 @@ interface FormSubmitterInterface {
* $form_state['redirect'].
*
* @param $form_state
- * An associative array containing the current state of the form.
+ * The current state of the form.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|null
*
* @see \Drupal\Core\Form\FormBuilderInterface::processForm()
* @see \Drupal\Core\Form\FormBuilderInterface::buildForm()
*/
- public function redirectForm($form_state);
+ public function redirectForm(FormStateInterface $form_state);
}
diff --git a/core/lib/Drupal/Core/Form/FormValidator.php b/core/lib/Drupal/Core/Form/FormValidator.php
index eda8238..e35f06a 100644
--- a/core/lib/Drupal/Core/Form/FormValidator.php
+++ b/core/lib/Drupal/Core/Form/FormValidator.php
@@ -55,7 +55,7 @@ class FormValidator implements FormValidatorInterface {
/**
* {@inheritdoc}
*/
- public function executeValidateHandlers(&$form, &$form_state) {
+ public function executeValidateHandlers(&$form, FormStateInterface &$form_state) {
// If there was a button pressed, use its handlers.
if (isset($form_state['validate_handlers'])) {
$handlers = $form_state['validate_handlers'];
@@ -76,7 +76,7 @@ class FormValidator implements FormValidatorInterface {
/**
* {@inheritdoc}
*/
- public function validateForm($form_id, &$form, &$form_state) {
+ public function validateForm($form_id, &$form, FormStateInterface &$form_state) {
// If this form is flagged to always validate, ensure that previous runs of
// validation are ignored.
if (!empty($form_state['must_validate'])) {
@@ -119,12 +119,12 @@ class FormValidator implements FormValidatorInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param string $form_id
* The unique string identifying the form.
*/
- protected function handleErrorsWithLimitedValidation(&$form, &$form_state, $form_id) {
+ protected function handleErrorsWithLimitedValidation(&$form, FormStateInterface &$form_state, $form_id) {
// If validation errors are limited then remove any non validated form values,
// so that only values that passed validation are left for submit callbacks.
if (isset($form_state['triggering_element']['#limit_validation_errors']) && $form_state['triggering_element']['#limit_validation_errors'] !== FALSE) {
@@ -171,12 +171,12 @@ class FormValidator implements FormValidatorInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param string $form_id
* The unique string identifying the form.
*/
- protected function finalizeValidation(&$form, &$form_state, $form_id) {
+ protected function finalizeValidation(&$form, FormStateInterface &$form_state, $form_id) {
// After validation, loop through and assign each element its errors.
$this->setElementErrorsFromFormState($form, $form_state);
// Mark this form as validated.
@@ -192,12 +192,12 @@ class FormValidator implements FormValidatorInterface {
*
* @param $elements
* An associative array containing the structure of the form.
- * @param $form_state
- * A keyed array containing the current state of the form. The current
- * user-submitted data is stored in $form_state['values'], though
- * form validation functions are passed an explicit copy of the
- * values for the sake of simplicity. Validation handlers can also
- * $form_state to pass information on to submit handlers. For example:
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form. The current user-submitted data is stored
+ * in $form_state['values'], though form validation functions are passed an
+ * explicit copy of the values for the sake of simplicity. Validation
+ * handlers can also $form_state to pass information on to submit handlers.
+ * For example:
* $form_state['data_for_submission'] = $data;
* This technique is useful when validation requires file parsing,
* web service requests, or other expensive requests that should
@@ -206,7 +206,7 @@ class FormValidator implements FormValidatorInterface {
* A unique string identifying the form for validation, submission,
* theming, and hook_form_alter functions.
*/
- protected function doValidateForm(&$elements, &$form_state, $form_id = NULL) {
+ protected function doValidateForm(&$elements, FormStateInterface &$form_state, $form_id = NULL) {
// Recurse through all children.
foreach (Element::children($elements) as $key) {
if (isset($elements[$key]) && $elements[$key]) {
@@ -289,18 +289,18 @@ class FormValidator implements FormValidatorInterface {
*
* @param array $elements
* An associative array containing the structure of the form.
- * @param array $form_state
- * A keyed array containing the current state of the form. The current
- * user-submitted data is stored in $form_state['values'], though
- * form validation functions are passed an explicit copy of the
- * values for the sake of simplicity. Validation handlers can also
- * $form_state to pass information on to submit handlers. For example:
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form. The current user-submitted data is stored
+ * in $form_state['values'], though form validation functions are passed an
+ * explicit copy of the values for the sake of simplicity. Validation
+ * handlers can also $form_state to pass information on to submit handlers.
+ * For example:
* $form_state['data_for_submission'] = $data;
* This technique is useful when validation requires file parsing,
* web service requests, or other expensive requests that should
* not be repeated in the submission step.
*/
- protected function performRequiredValidation(&$elements, &$form_state) {
+ protected function performRequiredValidation(&$elements, FormStateInterface &$form_state) {
// Verify that the value is not longer than #maxlength.
if (isset($elements['#maxlength']) && Unicode::strlen($elements['#value']) > $elements['#maxlength']) {
$this->setError($elements, $form_state, $this->t('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'], '%max' => $elements['#maxlength'], '%length' => Unicode::strlen($elements['#value']))));
@@ -345,12 +345,12 @@ class FormValidator implements FormValidatorInterface {
/**
* Determines if validation errors should be limited.
*
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array|null
*/
- protected function determineLimitValidationErrors(&$form_state) {
+ protected function determineLimitValidationErrors(FormStateInterface &$form_state) {
// While this element is being validated, it may be desired that some
// calls to self::setErrorByName() be suppressed and not result in a form
// error, so that a button that implements low-risk functionality (such as
@@ -395,10 +395,10 @@ class FormValidator implements FormValidatorInterface {
*
* @param array $elements
* An associative array containing the structure of a form element.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- protected function setElementErrorsFromFormState(array &$elements, array &$form_state) {
+ protected function setElementErrorsFromFormState(array &$elements, FormStateInterface &$form_state) {
// Recurse through all children.
foreach (Element::children($elements) as $key) {
if (isset($elements[$key]) && $elements[$key]) {
@@ -412,91 +412,43 @@ class FormValidator implements FormValidatorInterface {
/**
* {@inheritdoc}
*/
- public function setErrorByName($name, array &$form_state, $message = '') {
- if (!empty($form_state['validation_complete'])) {
- throw new \LogicException('Form errors cannot be set after form validation has finished.');
- }
-
- if (!isset($form_state['errors'][$name])) {
- $record = TRUE;
- if (isset($form_state['limit_validation_errors'])) {
- // #limit_validation_errors is an array of "sections" within which user
- // input must be valid. If the element is within one of these sections,
- // the error must be recorded. Otherwise, it can be suppressed.
- // #limit_validation_errors can be an empty array, in which case all
- // errors are suppressed. For example, a "Previous" button might want
- // its submit action to be triggered even if none of the submitted
- // values are valid.
- $record = FALSE;
- foreach ($form_state['limit_validation_errors'] as $section) {
- // Exploding by '][' reconstructs the element's #parents. If the
- // reconstructed #parents begin with the same keys as the specified
- // section, then the element's values are within the part of
- // $form_state['values'] that the clicked button requires to be valid,
- // so errors for this element must be recorded. As the exploded array
- // will all be strings, we need to cast every value of the section
- // array to string.
- if (array_slice(explode('][', $name), 0, count($section)) === array_map('strval', $section)) {
- $record = TRUE;
- break;
- }
- }
- }
- if ($record) {
- $form_state['errors'][$name] = $message;
- $this->requestStack->getCurrentRequest()->attributes->set('_form_errors', TRUE);
- if ($message) {
- $this->drupalSetMessage($message, 'error');
- }
- }
- }
-
- return $form_state['errors'];
+ public function setErrorByName($name, FormStateInterface &$form_state, $message = '') {
+ return $form_state->setErrorByName($name, $message);
}
/**
* {@inheritdoc}
*/
- public function setError(&$element, array &$form_state, $message = '') {
- $this->setErrorByName(implode('][', $element['#parents']), $form_state, $message);
+ public function setError(&$element, FormStateInterface &$form_state, $message = '') {
+ return $form_state->setError($element, $message);
}
/**
* {@inheritdoc}
*/
- public function getError($element, array &$form_state) {
- if ($errors = $this->getErrors($form_state)) {
- $parents = array();
- foreach ($element['#parents'] as $parent) {
- $parents[] = $parent;
- $key = implode('][', $parents);
- if (isset($errors[$key])) {
- return $errors[$key];
- }
- }
- }
+ public function getError($element, FormStateInterface &$form_state) {
+ return $form_state->getError($element);
}
/**
* {@inheritdoc}
*/
- public function clearErrors(array &$form_state) {
- $form_state['errors'] = array();
- $this->requestStack->getCurrentRequest()->attributes->set('_form_errors', FALSE);
+ public function clearErrors(FormStateInterface &$form_state) {
+ $form_state->clearErrors();
}
/**
* {@inheritdoc}
*/
- public function getErrors(array $form_state) {
- return $form_state['errors'];
+ public function getErrors(FormStateInterface &$form_state) {
+ return $form_state->getErrors();
}
/**
* {@inheritdoc}
*/
public function getAnyErrors() {
- return (bool) $this->requestStack->getCurrentRequest()->attributes->get('_form_errors');
+ return FormState::hasAnyErrors();
}
/**
@@ -506,13 +458,4 @@ class FormValidator implements FormValidatorInterface {
watchdog($type, $message, $variables, $severity, $link);
}
- /**
- * Wraps drupal_set_message().
- *
- * @return array|null
- */
- protected function drupalSetMessage($message = NULL, $type = 'status', $repeat = FALSE) {
- return drupal_set_message($message, $type, $repeat);
- }
-
}
diff --git a/core/lib/Drupal/Core/Form/FormValidatorInterface.php b/core/lib/Drupal/Core/Form/FormValidatorInterface.php
index 806e6a0..da8caa4 100644
--- a/core/lib/Drupal/Core/Form/FormValidatorInterface.php
+++ b/core/lib/Drupal/Core/Form/FormValidatorInterface.php
@@ -21,14 +21,14 @@ interface FormValidatorInterface extends FormErrorInterface {
* @param $form
* An associative array containing the structure of the form.
* @param $form_state
- * A keyed array containing the current state of the form. If the user
- * submitted the form by clicking a button with custom handler functions
- * defined, those handlers will be stored here.
+ * The current state of the form. If the user submitted the form by clicking
+ * a button with custom handler functions defined, those handlers will be
+ * stored here.
*/
- public function executeValidateHandlers(&$form, &$form_state);
+ public function executeValidateHandlers(&$form, FormStateInterface &$form_state);
/**
- * Validates user-submitted form data in the $form_state array.
+ * Validates user-submitted form data in the $form_state.
*
* @param $form_id
* A unique string identifying the form for validation, submission,
@@ -42,16 +42,16 @@ interface FormValidatorInterface extends FormErrorInterface {
* elements in $form_state['values'] to prevent form submit handlers from
* receiving unvalidated values.
* @param $form_state
- * A keyed array containing the current state of the form. The current
- * user-submitted data is stored in $form_state['values'], though
- * form validation functions are passed an explicit copy of the
- * values for the sake of simplicity. Validation handlers can also use
- * $form_state to pass information on to submit handlers. For example:
+ * The current state of the form. The current user-submitted data is stored
+ * in $form_state['values'], though form validation functions are passed an
+ * explicit copy of the values for the sake of simplicity. Validation
+ * handlers can also use $form_state to pass information on to submit
+ * handlers. For example:
* $form_state['data_for_submission'] = $data;
* This technique is useful when validation requires file parsing,
* web service requests, or other expensive requests that should
* not be repeated in the submission step.
*/
- public function validateForm($form_id, &$form, &$form_state);
+ public function validateForm($form_id, &$form, FormStateInterface &$form_state);
}
diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitInterface.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitInterface.php
index 30d424e..b50331a 100644
--- a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitInterface.php
+++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitInterface.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\ImageToolkit;
use Drupal\Component\Plugin\PluginInspectionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Image\ImageInterface;
/**
@@ -57,7 +58,7 @@ interface ImageToolkitInterface extends PluginInspectionInterface {
*
* @see system_image_toolkit_settings_submit()
*/
- public function settingsFormSubmit($form, &$form_state);
+ public function settingsFormSubmit($form, FormStateInterface $form_state);
/**
* Sets the image object that this toolkit instance is tied to.
diff --git a/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php b/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
index d3667f7..a5c0737 100644
--- a/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
@@ -10,6 +10,7 @@ namespace Drupal\Core\Installer\Form;
use Drupal\Component\Utility\String;
use Drupal\Component\Utility\UserAgent;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManager;
use Symfony\Component\HttpFoundation\Request;
@@ -28,7 +29,7 @@ class SelectLanguageForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, $install_state = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, $install_state = NULL) {
if (count($install_state['translations']) > 1) {
$files = $install_state['translations'];
}
@@ -96,7 +97,7 @@ class SelectLanguageForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$install_state = &$form_state['build_info']['args'][0];
$install_state['parameters']['langcode'] = $form_state['values']['langcode'];
}
diff --git a/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php b/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php
index d88bc56..e16c10e 100644
--- a/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Installer\Form;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Provides the profile selection form.
@@ -24,7 +25,7 @@ class SelectProfileForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, $install_state = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, $install_state = NULL) {
$form['#title'] = $this->t('Select an installation profile');
$profiles = array();
@@ -87,7 +88,7 @@ class SelectProfileForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
global $install_state;
$install_state['parameters']['profile'] = $form_state['values']['profile'];
}
diff --git a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
index 745665b..491a1d9 100644
--- a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Installer\Form;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Locale\CountryManagerInterface;
use Drupal\Core\State\StateInterface;
use Drupal\user\UserStorageInterface;
@@ -88,7 +89,7 @@ class SiteConfigureForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form['#title'] = $this->t('Configure site');
// Warn about settings.php permissions risk
@@ -227,7 +228,7 @@ class SiteConfigureForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
if ($error = user_validate_name($form_state['values']['account']['name'])) {
$this->setFormError('account][name', $form_state, $error);
}
@@ -236,7 +237,7 @@ class SiteConfigureForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('system.site')
->set('name', $form_state['values']['site_name'])
->set('mail', $form_state['values']['site_mail'])
diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
index 23f0d03..1020620 100644
--- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
@@ -10,6 +10,7 @@ namespace Drupal\Core\Installer\Form;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Database\Database;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Provides a form to configure and rewrite settings.php.
@@ -26,7 +27,7 @@ class SiteSettingsForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$conf_path = './' . conf_path(FALSE);
$settings_file = $conf_path . '/settings.php';
@@ -114,7 +115,7 @@ class SiteSettingsForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
$driver = $form_state['values']['driver'];
$database = $form_state['values'][$driver];
$drivers = drupal_get_database_types();
@@ -134,7 +135,7 @@ class SiteSettingsForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
global $install_state;
// Update global settings array and save.
diff --git a/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php
index 234fcb5..af3d43c 100644
--- a/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php
+++ b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Menu\Form;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Menu\MenuLinkInterface;
use Drupal\Core\Menu\MenuLinkManagerInterface;
use Drupal\Core\Menu\MenuParentFormSelectorInterface;
@@ -101,7 +102,7 @@ class MenuLinkDefaultForm implements MenuLinkFormInterface, ContainerInjectionIn
/**
* {@inheritdoc}
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['#title'] = $this->t('Edit menu link %title', array('%title' => $this->menuLink->getTitle()));
$provider = $this->menuLink->getProvider();
@@ -155,7 +156,7 @@ class MenuLinkDefaultForm implements MenuLinkFormInterface, ContainerInjectionIn
/**
* {@inheritdoc}
*/
- public function extractFormValues(array &$form, array &$form_state) {
+ public function extractFormValues(array &$form, FormStateInterface $form_state) {
$new_definition = array();
$new_definition['hidden'] = $form_state['values']['enabled'] ? 0 : 1;
$new_definition['weight'] = (int) $form_state['values']['weight'];
@@ -173,13 +174,13 @@ class MenuLinkDefaultForm implements MenuLinkFormInterface, ContainerInjectionIn
/**
* {@inheritdoc}
*/
- public function validateConfigurationForm(array &$form, array &$form_state) {
+ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$new_definition = $this->extractFormValues($form, $form_state);
return $this->menuLinkManager->updateDefinition($this->menuLink->getPluginId(), $new_definition);
diff --git a/core/lib/Drupal/Core/Menu/Form/MenuLinkFormInterface.php b/core/lib/Drupal/Core/Menu/Form/MenuLinkFormInterface.php
index f021890..fa0893b 100644
--- a/core/lib/Drupal/Core/Menu/Form/MenuLinkFormInterface.php
+++ b/core/lib/Drupal/Core/Menu/Form/MenuLinkFormInterface.php
@@ -7,6 +7,7 @@
namespace Drupal\Core\Menu\Form;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Menu\MenuLinkInterface;
use Drupal\Core\Plugin\PluginFormInterface;
@@ -33,12 +34,12 @@ interface MenuLinkFormInterface extends PluginFormInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* The new plugin definition values taken from the form values.
*/
- public function extractFormValues(array &$form, array &$form_state);
+ public function extractFormValues(array &$form, FormStateInterface $form_state);
}
diff --git a/core/lib/Drupal/Core/Plugin/PluginFormInterface.php b/core/lib/Drupal/Core/Plugin/PluginFormInterface.php
index daceeac..993c841 100644
--- a/core/lib/Drupal/Core/Plugin/PluginFormInterface.php
+++ b/core/lib/Drupal/Core/Plugin/PluginFormInterface.php
@@ -7,6 +7,8 @@
namespace Drupal\Core\Plugin;
+use Drupal\Core\Form\FormStateInterface;
+
/**
* Provides an interface for a plugin that contains a form.
*
@@ -19,32 +21,32 @@ interface PluginFormInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* The form structure.
*/
- public function buildConfigurationForm(array $form, array &$form_state);
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state);
/**
* Form validation handler.
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function validateConfigurationForm(array &$form, array &$form_state);
+ public function validateConfigurationForm(array &$form, FormStateInterface $form_state);
/**
* Form submission handler.
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function submitConfigurationForm(array &$form, array &$form_state);
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state);
}
diff --git a/core/lib/Drupal/Core/Update/Form/UpdateScriptSelectionForm.php b/core/lib/Drupal/Core/Update/Form/UpdateScriptSelectionForm.php
index b6d440d..574ec6c 100644
--- a/core/lib/Drupal/Core/Update/Form/UpdateScriptSelectionForm.php
+++ b/core/lib/Drupal/Core/Update/Form/UpdateScriptSelectionForm.php
@@ -8,6 +8,7 @@
namespace Drupal\Core\Update\Form;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Provides the list of available database module updates.
@@ -24,7 +25,7 @@ class UpdateScriptSelectionForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$count = 0;
$incompatible_count = 0;
$form['start'] = array(
@@ -127,7 +128,7 @@ class UpdateScriptSelectionForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
}
}
diff --git a/core/modules/action/src/ActionAddForm.php b/core/modules/action/src/ActionAddForm.php
index bae8dcb..6d8e4aa 100644
--- a/core/modules/action/src/ActionAddForm.php
+++ b/core/modules/action/src/ActionAddForm.php
@@ -10,6 +10,7 @@ namespace Drupal\action;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Action\ActionManager;
use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -54,7 +55,7 @@ class ActionAddForm extends ActionFormBase {
* @param string $action_id
* The hashed version of the action ID.
*/
- public function buildForm(array $form, array &$form_state, $action_id = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, $action_id = NULL) {
// In \Drupal\action\Form\ActionAdminManageForm::buildForm() the action
// are hashed. Here we have to decrypt it to find the desired action ID.
foreach ($this->actionManager->getDefinitions() as $id => $definition) {
diff --git a/core/modules/action/src/ActionFormBase.php b/core/modules/action/src/ActionFormBase.php
index c2cbee3..23b7f07 100644
--- a/core/modules/action/src/ActionFormBase.php
+++ b/core/modules/action/src/ActionFormBase.php
@@ -9,6 +9,7 @@ namespace Drupal\action;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -53,7 +54,7 @@ abstract class ActionFormBase extends EntityForm {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$this->plugin = $this->entity->getPlugin();
return parent::buildForm($form, $form_state);
}
@@ -61,7 +62,7 @@ abstract class ActionFormBase extends EntityForm {
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$form['label'] = array(
'#type' => 'textfield',
'#title' => $this->t('Label'),
@@ -113,7 +114,7 @@ abstract class ActionFormBase extends EntityForm {
/**
* {@inheritdoc}
*/
- protected function actions(array $form, array &$form_state) {
+ protected function actions(array $form, FormStateInterface $form_state) {
$actions = parent::actions($form, $form_state);
unset($actions['delete']);
return $actions;
@@ -122,7 +123,7 @@ abstract class ActionFormBase extends EntityForm {
/**
* {@inheritdoc}
*/
- public function validate(array $form, array &$form_state) {
+ public function validate(array $form, FormStateInterface $form_state) {
parent::validate($form, $form_state);
if ($this->plugin instanceof PluginFormInterface) {
@@ -133,7 +134,7 @@ abstract class ActionFormBase extends EntityForm {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
parent::submit($form, $form_state);
if ($this->plugin instanceof PluginFormInterface) {
@@ -145,7 +146,7 @@ abstract class ActionFormBase extends EntityForm {
/**
* {@inheritdoc}
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
$this->entity->save();
drupal_set_message($this->t('The action has been successfully saved.'));
diff --git a/core/modules/action/src/Form/ActionAdminManageForm.php b/core/modules/action/src/Form/ActionAdminManageForm.php
index fd1a0d0..81c08f4 100644
--- a/core/modules/action/src/Form/ActionAdminManageForm.php
+++ b/core/modules/action/src/Form/ActionAdminManageForm.php
@@ -10,6 +10,7 @@ namespace Drupal\action\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Action\ActionManager;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -53,7 +54,7 @@ class ActionAdminManageForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$actions = array();
foreach ($this->manager->getDefinitions() as $id => $definition) {
if (is_subclass_of($definition['class'], '\Drupal\Core\Plugin\PluginFormInterface')) {
@@ -87,7 +88,7 @@ class ActionAdminManageForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
if ($form_state['values']['action']) {
$form_state['redirect_route'] = array(
'route_name' => 'action.admin_add',
diff --git a/core/modules/action/src/Form/ActionDeleteForm.php b/core/modules/action/src/Form/ActionDeleteForm.php
index 1ca080a..a65d574 100644
--- a/core/modules/action/src/Form/ActionDeleteForm.php
+++ b/core/modules/action/src/Form/ActionDeleteForm.php
@@ -8,6 +8,7 @@
namespace Drupal\action\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
@@ -39,7 +40,7 @@ class ActionDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$this->entity->delete();
watchdog('user', 'Deleted action %aid (%action)', array('%aid' => $this->entity->id(), '%action' => $this->entity->label()));
diff --git a/core/modules/action/src/Plugin/Action/EmailAction.php b/core/modules/action/src/Plugin/Action/EmailAction.php
index c6589a6..a9a00a9 100644
--- a/core/modules/action/src/Plugin/Action/EmailAction.php
+++ b/core/modules/action/src/Plugin/Action/EmailAction.php
@@ -9,6 +9,7 @@ namespace Drupal\action\Plugin\Action;
use Drupal\Core\Action\ConfigurableActionBase;
use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Utility\Token;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -114,7 +115,7 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
/**
* {@inheritdoc}
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['recipient'] = array(
'#type' => 'textfield',
'#title' => t('Recipient'),
@@ -143,7 +144,7 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
/**
* {@inheritdoc}
*/
- public function validateConfigurationForm(array &$form, array &$form_state) {
+ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
if (!valid_email_address($form_state['values']['recipient']) && strpos($form_state['values']['recipient'], ':mail') === FALSE) {
// We want the literal %author placeholder to be emphasized in the error message.
form_set_error('recipient', $form_state, t('Enter a valid email address or use a token email address such as %author.', array('%author' => '[node:author:mail]')));
@@ -153,7 +154,7 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
/**
* {@inheritdoc}
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['recipient'] = $form_state['values']['recipient'];
$this->configuration['subject'] = $form_state['values']['subject'];
$this->configuration['message'] = $form_state['values']['message'];
diff --git a/core/modules/action/src/Plugin/Action/GotoAction.php b/core/modules/action/src/Plugin/Action/GotoAction.php
index e08d91f..40ba621 100644
--- a/core/modules/action/src/Plugin/Action/GotoAction.php
+++ b/core/modules/action/src/Plugin/Action/GotoAction.php
@@ -8,6 +8,7 @@
namespace Drupal\action\Plugin\Action;
use Drupal\Core\Action\ConfigurableActionBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -94,7 +95,7 @@ class GotoAction extends ConfigurableActionBase implements ContainerFactoryPlugi
/**
* {@inheritdoc}
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['url'] = array(
'#type' => 'textfield',
'#title' => t('URL'),
@@ -108,7 +109,7 @@ class GotoAction extends ConfigurableActionBase implements ContainerFactoryPlugi
/**
* {@inheritdoc}
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['url'] = $form_state['values']['url'];
}
diff --git a/core/modules/action/src/Plugin/Action/MessageAction.php b/core/modules/action/src/Plugin/Action/MessageAction.php
index cc15650..ece48fa 100644
--- a/core/modules/action/src/Plugin/Action/MessageAction.php
+++ b/core/modules/action/src/Plugin/Action/MessageAction.php
@@ -9,6 +9,7 @@ namespace Drupal\action\Plugin\Action;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Action\ConfigurableActionBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Utility\Token;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -68,7 +69,7 @@ class MessageAction extends ConfigurableActionBase implements ContainerFactoryPl
/**
* {@inheritdoc}
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['message'] = array(
'#type' => 'textarea',
'#title' => t('Message'),
@@ -83,7 +84,7 @@ class MessageAction extends ConfigurableActionBase implements ContainerFactoryPl
/**
* {@inheritdoc}
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['message'] = $form_state['values']['message'];
unset($this->configuration['node']);
}
diff --git a/core/modules/aggregator/src/FeedForm.php b/core/modules/aggregator/src/FeedForm.php
index e832d87..6d9d3ea 100644
--- a/core/modules/aggregator/src/FeedForm.php
+++ b/core/modules/aggregator/src/FeedForm.php
@@ -10,6 +10,7 @@ namespace Drupal\aggregator;
use Drupal\Component\Utility\String;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -21,7 +22,7 @@ class FeedForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$feed = $this->entity;
// @todo: convert to a language selection widget defined in the base field.
@@ -41,7 +42,7 @@ class FeedForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function validate(array $form, array &$form_state) {
+ public function validate(array $form, FormStateInterface $form_state) {
$feed = $this->buildEntity($form, $form_state);
// Check for duplicate titles.
$feed_storage = $this->entityManager->getStorage('aggregator_feed');
@@ -60,7 +61,7 @@ class FeedForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
$feed = $this->entity;
$insert = (bool) $feed->id();
$feed->save();
diff --git a/core/modules/aggregator/src/Form/FeedDeleteForm.php b/core/modules/aggregator/src/Form/FeedDeleteForm.php
index e7efd14..83c171e 100644
--- a/core/modules/aggregator/src/Form/FeedDeleteForm.php
+++ b/core/modules/aggregator/src/Form/FeedDeleteForm.php
@@ -8,6 +8,7 @@
namespace Drupal\aggregator\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
@@ -39,7 +40,7 @@ class FeedDeleteForm extends ContentEntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$this->entity->delete();
watchdog('aggregator', 'Feed %feed deleted.', array('%feed' => $this->entity->label()));
drupal_set_message($this->t('The feed %feed has been deleted.', array('%feed' => $this->entity->label())));
diff --git a/core/modules/aggregator/src/Form/FeedItemsDeleteForm.php b/core/modules/aggregator/src/Form/FeedItemsDeleteForm.php
index 0da20f6..2d79aa2 100644
--- a/core/modules/aggregator/src/Form/FeedItemsDeleteForm.php
+++ b/core/modules/aggregator/src/Form/FeedItemsDeleteForm.php
@@ -8,6 +8,7 @@
namespace Drupal\aggregator\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
@@ -39,7 +40,7 @@ class FeedItemsDeleteForm extends ContentEntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$this->entity->deleteItems();
$form_state['redirect_route'] = $this->getCancelUrl();
diff --git a/core/modules/aggregator/src/Form/OpmlFeedAdd.php b/core/modules/aggregator/src/Form/OpmlFeedAdd.php
index 0613f48..3bed94f 100644
--- a/core/modules/aggregator/src/Form/OpmlFeedAdd.php
+++ b/core/modules/aggregator/src/Form/OpmlFeedAdd.php
@@ -10,6 +10,7 @@ namespace Drupal\aggregator\Form;
use Drupal\aggregator\FeedStorageInterface;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\ClientInterface;
@@ -66,7 +67,7 @@ class OpmlFeedAdd extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$intervals = array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200);
$period = array_map(array(\Drupal::service('date'), 'formatInterval'), array_combine($intervals, $intervals));
@@ -101,7 +102,7 @@ class OpmlFeedAdd extends FormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
// If both fields are empty or filled, cancel.
$file_upload = $this->getRequest()->files->get('files[upload]', NULL, TRUE);
if (empty($form_state['values']['remote']) == empty($file_upload)) {
@@ -112,7 +113,7 @@ class OpmlFeedAdd extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$validators = array('file_validate_extensions' => array('opml xml'));
if ($file = file_save_upload('upload', $validators, FALSE, 0)) {
$data = file_get_contents($file->getFileUri());
diff --git a/core/modules/aggregator/src/Form/SettingsForm.php b/core/modules/aggregator/src/Form/SettingsForm.php
index 075b614..3177742 100644
--- a/core/modules/aggregator/src/Form/SettingsForm.php
+++ b/core/modules/aggregator/src/Form/SettingsForm.php
@@ -10,6 +10,7 @@ namespace Drupal\aggregator\Form;
use Drupal\aggregator\Plugin\AggregatorPluginManager;
use Drupal\Component\Utility\String;
use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\Form\ConfigFormBase;
@@ -98,7 +99,7 @@ class SettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('aggregator.settings');
// Global aggregator settings.
@@ -187,7 +188,7 @@ class SettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
// Let active plugins validate their settings.
foreach ($this->configurableInstances as $instance) {
@@ -198,7 +199,7 @@ class SettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$config = $this->config('aggregator.settings');
// Let active plugins save their settings.
diff --git a/core/modules/aggregator/src/Plugin/AggregatorPluginSettingsBase.php b/core/modules/aggregator/src/Plugin/AggregatorPluginSettingsBase.php
index ee94c7c..eb6ad36 100644
--- a/core/modules/aggregator/src/Plugin/AggregatorPluginSettingsBase.php
+++ b/core/modules/aggregator/src/Plugin/AggregatorPluginSettingsBase.php
@@ -8,6 +8,7 @@
namespace Drupal\aggregator\Plugin;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Plugin\PluginFormInterface;
@@ -35,7 +36,7 @@ abstract class AggregatorPluginSettingsBase extends PluginBase implements Plugin
/**
* {@inheritdoc}
*/
- public function validateConfigurationForm(array &$form, array &$form_state) {
+ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
diff --git a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
index 039ccea..38f4756 100644
--- a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
+++ b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
@@ -12,6 +12,7 @@ use Drupal\aggregator\FeedStorageInterface;
use Drupal\aggregator\ItemStorageInterface;
use Drupal\block\BlockBase;
use Drupal\Core\Entity\Query\QueryInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -114,9 +115,9 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt
}
/**
- * Overrides \Drupal\block\BlockBase::blockForm().
+ * {@inheritdoc}
*/
- public function blockForm($form, &$form_state) {
+ public function blockForm($form, FormStateInterface $form_state) {
$feeds = $this->feedStorage->loadMultiple();
$options = array();
foreach ($feeds as $feed) {
@@ -139,9 +140,9 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt
}
/**
- * Overrides \Drupal\block\BlockBase::blockSubmit().
+ * {@inheritdoc}
*/
- public function blockSubmit($form, &$form_state) {
+ public function blockSubmit($form, FormStateInterface $form_state) {
$this->configuration['block_count'] = $form_state['values']['block_count'];
$this->configuration['feed'] = $form_state['values']['feed'];
}
diff --git a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php
index 5fe77b8..c97c04d 100644
--- a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php
+++ b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php
@@ -15,6 +15,7 @@ use Drupal\Core\Database\Database;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Datetime\Date as DateFormatter;
use Drupal\Core\Entity\Query\QueryInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -105,7 +106,7 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
/**
* {@inheritdoc}
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$processors = $this->configuration['processors'];
$info = $this->getPluginDefinition();
$counts = array(3, 5, 10, 15, 20, 25);
@@ -161,7 +162,7 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
/**
* {@inheritdoc}
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['items']['expire'] = $form_state['values']['aggregator_clear'];
$this->configuration['items']['teaser_length'] = $form_state['values']['aggregator_teaser_length'];
$this->configuration['source']['list_max'] = $form_state['values']['aggregator_summary_items'];
diff --git a/core/modules/aggregator/src/Plugin/views/field/TitleLink.php b/core/modules/aggregator/src/Plugin/views/field/TitleLink.php
index 725b82d..9ab50bf 100644
--- a/core/modules/aggregator/src/Plugin/views/field/TitleLink.php
+++ b/core/modules/aggregator/src/Plugin/views/field/TitleLink.php
@@ -7,6 +7,7 @@
namespace Drupal\aggregator\Plugin\views\field;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
@@ -45,7 +46,7 @@ class TitleLink extends FieldPluginBase {
/**
* {@inheritdoc}
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['display_as_link'] = array(
'#title' => t('Display as link'),
'#type' => 'checkbox',
diff --git a/core/modules/aggregator/src/Plugin/views/row/Rss.php b/core/modules/aggregator/src/Plugin/views/row/Rss.php
index f9a73a6..ff59828 100644
--- a/core/modules/aggregator/src/Plugin/views/row/Rss.php
+++ b/core/modules/aggregator/src/Plugin/views/row/Rss.php
@@ -7,6 +7,7 @@
namespace Drupal\aggregator\Plugin\views\row;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\row\RowPluginBase;
/**
@@ -51,7 +52,7 @@ class Rss extends RowPluginBase {
/**
* {@inheritdoc}
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['view_mode'] = array(
'#type' => 'select',
'#title' => t('Display type'),
diff --git a/core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/processor/TestProcessor.php b/core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/processor/TestProcessor.php
index 9b76fc9..b4f5fd5 100644
--- a/core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/processor/TestProcessor.php
+++ b/core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/processor/TestProcessor.php
@@ -11,6 +11,7 @@ use Drupal\aggregator\Plugin\AggregatorPluginSettingsBase;
use Drupal\aggregator\Plugin\ProcessorInterface;
use Drupal\aggregator\FeedInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -66,7 +67,7 @@ class TestProcessor extends AggregatorPluginSettingsBase implements ProcessorInt
/**
* {@inheritdoc}
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$processors = $this->configFactory->get('aggregator.settings')->get('processors');
$info = $this->getPluginDefinition();
@@ -90,7 +91,7 @@ class TestProcessor extends AggregatorPluginSettingsBase implements ProcessorInt
/**
* {@inheritdoc}
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['items']['dummy_length'] = $form_state['values']['dummy_length'];
$this->setConfiguration($this->configuration);
}
diff --git a/core/modules/aggregator/tests/src/Plugin/AggregatorPluginSettingsBaseTest.php b/core/modules/aggregator/tests/src/Plugin/AggregatorPluginSettingsBaseTest.php
index b9390ff..90a4b69 100644
--- a/core/modules/aggregator/tests/src/Plugin/AggregatorPluginSettingsBaseTest.php
+++ b/core/modules/aggregator/tests/src/Plugin/AggregatorPluginSettingsBaseTest.php
@@ -8,6 +8,7 @@
namespace Drupal\aggregator\Tests\Plugin {
use Drupal\aggregator\Form\SettingsForm;
+use Drupal\Core\Form\FormState;
use Drupal\Tests\UnitTestCase;
/**
@@ -73,7 +74,7 @@ class AggregatorPluginSettingsBaseTest extends UnitTestCase {
*/
public function testSettingsForm() {
// Emulate a form state of a sumbitted form.
- $form_state = array('values' => array('dummy_length' => '', 'aggregator_allowed_html_tags' => ''));
+ $form_state = new FormState(array('values' => array('dummy_length' => '', 'aggregator_allowed_html_tags' => '')));
$test_processor = $this->getMock(
'Drupal\aggregator_test\Plugin\aggregator\processor\TestProcessor',
diff --git a/core/modules/ban/src/Form/BanAdmin.php b/core/modules/ban/src/Form/BanAdmin.php
index 3675e09..bd87ba8 100644
--- a/core/modules/ban/src/Form/BanAdmin.php
+++ b/core/modules/ban/src/Form/BanAdmin.php
@@ -9,6 +9,7 @@ namespace Drupal\ban\Form;
use Drupal\Core\Form\FormBase;
use Drupal\ban\BanIpManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -54,7 +55,7 @@ class BanAdmin extends FormBase {
* \Drupal::formBuilder()->getForm() for use as the default value of the IP
* address form field.
*/
- public function buildForm(array $form, array &$form_state, $default_ip = '') {
+ public function buildForm(array $form, FormStateInterface $form_state, $default_ip = '') {
$rows = array();
$header = array($this->t('banned IP addresses'), $this->t('Operations'));
$result = $this->ipManager->findAll();
@@ -103,7 +104,7 @@ class BanAdmin extends FormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
$ip = trim($form_state['values']['ip']);
if ($this->ipManager->isBanned($ip)) {
$this->setFormError('ip', $form_state, $this->t('This IP address is already banned.'));
@@ -119,7 +120,7 @@ class BanAdmin extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$ip = trim($form_state['values']['ip']);
$this->ipManager->banIp($ip);
drupal_set_message($this->t('The IP address %ip has been banned.', array('%ip' => $ip)));
diff --git a/core/modules/ban/src/Form/BanDelete.php b/core/modules/ban/src/Form/BanDelete.php
index 1e41439..b607ba9 100644
--- a/core/modules/ban/src/Form/BanDelete.php
+++ b/core/modules/ban/src/Form/BanDelete.php
@@ -9,6 +9,7 @@ namespace Drupal\ban\Form;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\ban\BanIpManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -78,7 +79,7 @@ class BanDelete extends ConfirmFormBase {
* @param string $ban_id
* The IP address record ID to unban.
*/
- public function buildForm(array $form, array &$form_state, $ban_id = '') {
+ public function buildForm(array $form, FormStateInterface $form_state, $ban_id = '') {
if (!$this->banIp = $this->ipManager->findById($ban_id)) {
throw new NotFoundHttpException();
}
@@ -88,7 +89,7 @@ class BanDelete extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$this->ipManager->unbanIp($this->banIp);
watchdog('user', 'Deleted %ip', array('%ip' => $this->banIp));
drupal_set_message($this->t('The IP address %ip was deleted.', array('%ip' => $this->banIp)));
diff --git a/core/modules/block/src/BlockBase.php b/core/modules/block/src/BlockBase.php
index 70e83e8..ca94ba0 100644
--- a/core/modules/block/src/BlockBase.php
+++ b/core/modules/block/src/BlockBase.php
@@ -12,6 +12,8 @@ use Drupal\block\Event\BlockEvents;
use Drupal\Component\Plugin\ContextAwarePluginInterface;
use Drupal\Core\Condition\ConditionAccessResolverTrait;
use Drupal\Core\Condition\ConditionPluginBag;
+use Drupal\Core\Form\FormState;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContextAwarePluginBase;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\NestedArray;
@@ -198,7 +200,7 @@ abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginIn
*
* @see \Drupal\block\BlockBase::blockForm()
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$definition = $this->getPluginDefinition();
$form['provider'] = array(
'#type' => 'value',
@@ -323,7 +325,7 @@ abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginIn
/**
* {@inheritdoc}
*/
- public function blockForm($form, &$form_state) {
+ public function blockForm($form, FormStateInterface $form_state) {
return array();
}
@@ -335,7 +337,7 @@ abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginIn
*
* @see \Drupal\block\BlockBase::blockValidate()
*/
- public function validateConfigurationForm(array &$form, array &$form_state) {
+ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
// Remove the admin_label form item element value so it will not persist.
unset($form_state['values']['admin_label']);
@@ -344,10 +346,12 @@ abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginIn
foreach ($this->getVisibilityConditions() as $condition_id => $condition) {
// Allow the condition to validate the form.
- $condition_values = array(
- 'values' => &$form_state['values']['visibility'][$condition_id],
- );
+ $condition_values = new FormState(array(
+ 'values' => $form_state['values']['visibility'][$condition_id],
+ ));
$condition->validateConfigurationForm($form, $condition_values);
+ // Update the original form values.
+ $form_state['values']['visibility'][$condition_id] = $condition_values['values'];
}
$this->blockValidate($form, $form_state);
@@ -356,7 +360,7 @@ abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginIn
/**
* {@inheritdoc}
*/
- public function blockValidate($form, &$form_state) {}
+ public function blockValidate($form, FormStateInterface $form_state) {}
/**
* {@inheritdoc}
@@ -366,7 +370,7 @@ abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginIn
*
* @see \Drupal\block\BlockBase::blockSubmit()
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
// Process the block's submission handling if no errors occurred only.
if (!form_get_errors($form_state)) {
$this->configuration['label'] = $form_state['values']['label'];
@@ -375,10 +379,12 @@ abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginIn
$this->configuration['cache'] = $form_state['values']['cache'];
foreach ($this->getVisibilityConditions() as $condition_id => $condition) {
// Allow the condition to submit the form.
- $condition_values = array(
- 'values' => &$form_state['values']['visibility'][$condition_id],
- );
+ $condition_values = new FormState(array(
+ 'values' => $form_state['values']['visibility'][$condition_id],
+ ));
$condition->submitConfigurationForm($form, $condition_values);
+ // Update the original form values.
+ $form_state['values']['visibility'][$condition_id] = $condition_values['values'];
}
$this->blockSubmit($form, $form_state);
}
@@ -387,7 +393,7 @@ abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginIn
/**
* {@inheritdoc}
*/
- public function blockSubmit($form, &$form_state) {}
+ public function blockSubmit($form, FormStateInterface $form_state) {}
/**
* {@inheritdoc}
diff --git a/core/modules/block/src/BlockForm.php b/core/modules/block/src/BlockForm.php
index f562f52..704f3d1 100644
--- a/core/modules/block/src/BlockForm.php
+++ b/core/modules/block/src/BlockForm.php
@@ -9,6 +9,8 @@ namespace Drupal\block;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Form\FormState;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -52,7 +54,7 @@ class BlockForm extends EntityForm {
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
// Store theme settings in $form_state for use below.
@@ -125,7 +127,7 @@ class BlockForm extends EntityForm {
/**
* Handles switching the available regions based on the selected theme.
*/
- public function themeSwitch($form, &$form_state) {
+ public function themeSwitch($form, FormStateInterface $form_state) {
$form['region']['#options'] = system_region_list($form_state['values']['theme'], REGIONS_VISIBLE);
return $form['region'];
}
@@ -133,7 +135,7 @@ class BlockForm extends EntityForm {
/**
* {@inheritdoc}
*/
- protected function actions(array $form, array &$form_state) {
+ protected function actions(array $form, FormStateInterface $form_state) {
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->t('Save block');
return $actions;
@@ -142,35 +144,38 @@ class BlockForm extends EntityForm {
/**
* {@inheritdoc}
*/
- public function validate(array $form, array &$form_state) {
+ public function validate(array $form, FormStateInterface $form_state) {
parent::validate($form, $form_state);
// The Block Entity form puts all block plugin form elements in the
// settings form element, so just pass that to the block for validation.
- $settings = array(
- 'values' => &$form_state['values']['settings']
- );
+ $settings = new FormState(array(
+ 'values' => $form_state['values']['settings']
+ ));
// Call the plugin validate handler.
$this->entity->getPlugin()->validateConfigurationForm($form, $settings);
+ // Update the original form values.
+ $form_state['values']['settings'] = $settings['values'];
}
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
parent::submit($form, $form_state);
$entity = $this->entity;
// The Block Entity form puts all block plugin form elements in the
// settings form element, so just pass that to the block for submission.
// @todo Find a way to avoid this manipulation.
- $settings = array(
- 'values' => &$form_state['values']['settings'],
- 'errors' => $form_state['errors'],
- );
+ $settings = new FormState(array(
+ 'values' => $form_state['values']['settings'],
+ ));
// Call the plugin submit handler.
$entity->getPlugin()->submitConfigurationForm($form, $settings);
+ // Update the original form values.
+ $form_state['values']['settings'] = $settings['values'];
// Save the settings of the plugin.
$entity->save();
diff --git a/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php
index 1bf034d..1b26b9f 100644
--- a/core/modules/block/src/BlockListBuilder.php
+++ b/core/modules/block/src/BlockListBuilder.php
@@ -15,6 +15,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormInterface;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -133,7 +134,7 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
*
* Form constructor for the main block administration form.
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$placement = FALSE;
if ($this->request->query->has('block-placement')) {
$placement = $this->request->query->get('block-placement');
@@ -388,7 +389,7 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
/**
* Implements \Drupal\Core\Form\FormInterface::validateForm().
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
// No validation.
}
@@ -397,7 +398,7 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
*
* Form submission handler for the main block administration form.
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$entities = entity_load_multiple('block', array_keys($form_state['values']['blocks']));
foreach ($entities as $entity_id => $entity) {
$entity->set('weight', $form_state['values']['blocks'][$entity_id]['weight']);
diff --git a/core/modules/block/src/BlockPluginInterface.php b/core/modules/block/src/BlockPluginInterface.php
index f1a94ca..05d0ce5 100644
--- a/core/modules/block/src/BlockPluginInterface.php
+++ b/core/modules/block/src/BlockPluginInterface.php
@@ -12,6 +12,7 @@ use Drupal\Component\Plugin\DerivativeInspectionInterface;
use Drupal\Core\Cache\CacheableInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\Core\Session\AccountInterface;
@@ -88,47 +89,47 @@ interface BlockPluginInterface extends ConfigurablePluginInterface, PluginFormIn
*
* @param array $form
* The form definition array for the block configuration form.
- * @param array $form_state
- * An array containing the current state of the configuration form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array $form
* The renderable form array representing the entire configuration form.
*/
- public function blockForm($form, &$form_state);
+ public function blockForm($form, FormStateInterface $form_state);
/**
* Adds block type-specific validation for the block form.
*
- * Note that this method takes the form structure and form state arrays for
- * the full block configuration form as arguments, not just the elements
- * defined in BlockPluginInterface::blockForm().
+ * Note that this method takes the form structure and form state for the full
+ * block configuration form as arguments, not just the elements defined in
+ * BlockPluginInterface::blockForm().
*
* @param array $form
* The form definition array for the full block configuration form.
- * @param array $form_state
- * An array containing the current state of the configuration form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @see \Drupal\block\BlockPluginInterface::blockForm()
* @see \Drupal\block\BlockPluginInterface::blockSubmit()
*/
- public function blockValidate($form, &$form_state);
+ public function blockValidate($form, FormStateInterface $form_state);
/**
* Adds block type-specific submission handling for the block form.
*
- * Note that this method takes the form structure and form state arrays for
- * the full block configuration form as arguments, not just the elements
- * defined in BlockPluginInterface::blockForm().
+ * Note that this method takes the form structure and form state for the full
+ * block configuration form as arguments, not just the elements defined in
+ * BlockPluginInterface::blockForm().
*
* @param array $form
* The form definition array for the full block configuration form.
- * @param array $form_state
- * An array containing the current state of the configuration form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @see \Drupal\block\BlockPluginInterface::blockForm()
* @see \Drupal\block\BlockPluginInterface::blockValidate()
*/
- public function blockSubmit($form, &$form_state);
+ public function blockSubmit($form, FormStateInterface $form_state);
/**
* Suggests a machine name to identify an instance of this block.
diff --git a/core/modules/block/src/Form/BlockDeleteForm.php b/core/modules/block/src/Form/BlockDeleteForm.php
index 336888f..d811247 100644
--- a/core/modules/block/src/Form/BlockDeleteForm.php
+++ b/core/modules/block/src/Form/BlockDeleteForm.php
@@ -8,6 +8,7 @@
namespace Drupal\block\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
@@ -39,7 +40,7 @@ class BlockDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message($this->t('The block %name has been removed.', array('%name' => $this->entity->label())));
$form_state['redirect_route'] = $this->getCancelUrl();
diff --git a/core/modules/block/src/Plugin/views/display/Block.php b/core/modules/block/src/Plugin/views/display/Block.php
index 9ee2ca9..0e2e968 100644
--- a/core/modules/block/src/Plugin/views/display/Block.php
+++ b/core/modules/block/src/Plugin/views/display/Block.php
@@ -9,6 +9,7 @@
namespace Drupal\block\Plugin\views\display;
use Drupal\Component\Utility\String;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\Block\ViewsBlock;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Views;
@@ -140,7 +141,7 @@ class Block extends DisplayPluginBase {
/**
* Provide the default form for setting options.
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
switch ($form_state['section']) {
@@ -201,7 +202,7 @@ class Block extends DisplayPluginBase {
* Perform any necessary changes to the form values prior to storage.
* There is no need for this function to actually store the data.
*/
- public function submitOptionsForm(&$form, &$form_state) {
+ public function submitOptionsForm(&$form, FormStateInterface $form_state) {
parent::submitOptionsForm($form, $form_state);
switch ($form_state['section']) {
case 'block_description':
@@ -222,15 +223,15 @@ class Block extends DisplayPluginBase {
* The ViewsBlock plugin.
* @param array $form
* The form definition array for the block configuration form.
- * @param array $form_state
- * An array containing the current state of the configuration form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array $form
* The renderable form array representing the entire configuration form.
*
* @see \Drupal\views\Plugin\Block\ViewsBlock::blockForm()
*/
- public function blockForm(ViewsBlock $block, array &$form, array &$form_state) {
+ public function blockForm(ViewsBlock $block, array &$form, FormStateInterface $form_state) {
$allow_settings = array_filter($this->getOption('allow'));
$block_configuration = $block->getConfiguration();
@@ -267,12 +268,12 @@ class Block extends DisplayPluginBase {
* The ViewsBlock plugin.
* @param array $form
* The form definition array for the block configuration form.
- * @param array $form_state
- * An array containing the current state of the configuration form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @see \Drupal\views\Plugin\Block\ViewsBlock::blockValidate()
*/
- public function blockValidate(ViewsBlock $block, array $form, array &$form_state) {
+ public function blockValidate(ViewsBlock $block, array $form, FormStateInterface $form_state) {
}
/**
@@ -282,12 +283,12 @@ class Block extends DisplayPluginBase {
* The ViewsBlock plugin.
* @param array $form
* The form definition array for the full block configuration form.
- * @param array $form_state
- * An array containing the current state of the configuration form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* * @see \Drupal\views\Plugin\Block\ViewsBlock::blockSubmit()
*/
- public function blockSubmit(ViewsBlock $block, $form, &$form_state) {
+ public function blockSubmit(ViewsBlock $block, $form, FormStateInterface $form_state) {
if (isset($form_state['values']['override']['items_per_page'])) {
$block->setConfigurationValue('items_per_page', $form_state['values']['override']['items_per_page']);
}
diff --git a/core/modules/block/src/Tests/BlockInterfaceTest.php b/core/modules/block/src/Tests/BlockInterfaceTest.php
index bd4c55c..29097e5 100644
--- a/core/modules/block/src/Tests/BlockInterfaceTest.php
+++ b/core/modules/block/src/Tests/BlockInterfaceTest.php
@@ -7,6 +7,7 @@
namespace Drupal\block\Tests;
+use Drupal\Core\Form\FormState;
use Drupal\simpletest\DrupalUnitTestBase;
use Drupal\block\BlockInterface;
@@ -118,7 +119,7 @@ class BlockInterfaceTest extends DrupalUnitTestBase {
'#default_value' => 'My custom display message.',
),
);
- $form_state = array();
+ $form_state = new FormState();
// Ensure there are no form elements that do not belong to the plugin.
$actual_form = $display_block->buildConfigurationForm(array(), $form_state);
// Remove the visibility sections, as that just tests condition plugins.
diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php
index 9a4db70..255ba63 100644
--- a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php
+++ b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php
@@ -8,6 +8,7 @@
namespace Drupal\block_test\Plugin\Block;
use Drupal\block\BlockBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
/**
@@ -39,7 +40,7 @@ class TestBlockInstantiation extends BlockBase {
/**
* {@inheritdoc}
*/
- public function blockForm($form, &$form_state) {
+ public function blockForm($form, FormStateInterface $form_state) {
$form['display_message'] = array(
'#type' => 'textfield',
'#title' => t('Display message'),
@@ -51,7 +52,7 @@ class TestBlockInstantiation extends BlockBase {
/**
* {@inheritdoc}
*/
- public function blockSubmit($form, &$form_state) {
+ public function blockSubmit($form, FormStateInterface $form_state) {
$this->configuration['display_message'] = $form_state['values']['display_message'];
}
diff --git a/core/modules/block_content/src/BlockContentForm.php b/core/modules/block_content/src/BlockContentForm.php
index 22ef45b..1524f42 100644
--- a/core/modules/block_content/src/BlockContentForm.php
+++ b/core/modules/block_content/src/BlockContentForm.php
@@ -10,6 +10,7 @@ namespace Drupal\block_content;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Language\LanguageManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -83,7 +84,7 @@ class BlockContentForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$block = $this->entity;
$account = $this->currentUser();
@@ -174,7 +175,7 @@ class BlockContentForm extends ContentEntityForm {
* form state's entity with the current step's values before proceeding to the
* next step.
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
// Build the block object from the submitted values.
$block = parent::submit($form, $form_state);
@@ -189,7 +190,7 @@ class BlockContentForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
$block = $this->entity;
$insert = $block->isNew();
$block->save();
@@ -236,7 +237,7 @@ class BlockContentForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
if ($this->entity->isNew()) {
$exists = $this->blockContentStorage->loadByProperties(array('info' => $form_state['values']['info']));
if (!empty($exists)) {
diff --git a/core/modules/block_content/src/BlockContentTranslationHandler.php b/core/modules/block_content/src/BlockContentTranslationHandler.php
index 148e249..ca7a6d9 100644
--- a/core/modules/block_content/src/BlockContentTranslationHandler.php
+++ b/core/modules/block_content/src/BlockContentTranslationHandler.php
@@ -9,6 +9,7 @@ namespace Drupal\block_content;
use Drupal\Core\Entity\EntityInterface;
use Drupal\content_translation\ContentTranslationHandler;
+use Drupal\Core\Form\FormStateInterface;
/**
* Defines the translation handler for custom blocks.
@@ -18,7 +19,7 @@ class BlockContentTranslationHandler extends ContentTranslationHandler {
/**
* {@inheritdoc}
*/
- public function entityFormAlter(array &$form, array &$form_state, EntityInterface $entity) {
+ public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity) {
parent::entityFormAlter($form, $form_state, $entity);
// Move the translation fieldset to a vertical tab.
if (isset($form['translation'])) {
diff --git a/core/modules/block_content/src/BlockContentTypeForm.php b/core/modules/block_content/src/BlockContentTypeForm.php
index e64bfa3..025d673 100644
--- a/core/modules/block_content/src/BlockContentTypeForm.php
+++ b/core/modules/block_content/src/BlockContentTypeForm.php
@@ -9,6 +9,7 @@ namespace Drupal\block_content;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Base form for category edit forms.
@@ -16,9 +17,9 @@ use Drupal\Core\Entity\EntityTypeInterface;
class BlockContentTypeForm extends EntityForm {
/**
- * Overrides \Drupal\Core\Entity\EntityForm::form().
+ * {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$block_type = $this->entity;
@@ -87,7 +88,7 @@ class BlockContentTypeForm extends EntityForm {
/**
* Overrides \Drupal\Core\Entity\EntityForm::save().
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
$block_type = $this->entity;
$status = $block_type->save();
diff --git a/core/modules/block_content/src/Form/BlockContentDeleteForm.php b/core/modules/block_content/src/Form/BlockContentDeleteForm.php
index 6367c87..88249ae 100644
--- a/core/modules/block_content/src/Form/BlockContentDeleteForm.php
+++ b/core/modules/block_content/src/Form/BlockContentDeleteForm.php
@@ -8,6 +8,7 @@
namespace Drupal\block_content\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
@@ -39,7 +40,7 @@ class BlockContentDeleteForm extends ContentEntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$instances = $this->entity->getInstances();
$form['message'] = array(
@@ -53,7 +54,7 @@ class BlockContentDeleteForm extends ContentEntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message($this->t('Custom block %label has been deleted.', array('%label' => $this->entity->label())));
watchdog('block_content', 'Custom block %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE);
diff --git a/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php b/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php
index c4ef05a..decda49 100644
--- a/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php
+++ b/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php
@@ -9,6 +9,7 @@ namespace Drupal\block_content\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -67,7 +68,7 @@ class BlockContentTypeDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$blocks = $this->queryFactory->get('block_content')->condition('type', $this->entity->id())->execute();
if (!empty($blocks)) {
$caption = '<p>' . format_plural(count($blocks), '%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', '%label is used by @count custom blocks on your site. You may not remove %label until you have removed all of the %label custom blocks.', array('%label' => $this->entity->label())) . '</p>';
@@ -82,7 +83,7 @@ class BlockContentTypeDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message(t('Custom block type %label has been deleted.', array('%label' => $this->entity->label())));
watchdog('block_content', 'Custom block type %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE);
diff --git a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
index 49a53dc..8a5a409 100644
--- a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
+++ b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
@@ -11,6 +11,7 @@ use Drupal\block\BlockBase;
use Drupal\block\BlockManagerInterface;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Session\AccountInterface;
@@ -120,7 +121,7 @@ class BlockContentBlock extends BlockBase implements ContainerFactoryPluginInter
*
* Adds body and description fields to the block configuration form.
*/
- public function blockForm($form, &$form_state) {
+ public function blockForm($form, FormStateInterface $form_state) {
$form['block_content']['view_mode'] = array(
'#type' => 'select',
'#options' => $this->entityManager->getViewModeOptions('block_content'),
@@ -133,9 +134,9 @@ class BlockContentBlock extends BlockBase implements ContainerFactoryPluginInter
}
/**
- * Overrides \Drupal\block\BlockBase::blockSubmit().
+ * {@inheritdoc}
*/
- public function blockSubmit($form, &$form_state) {
+ public function blockSubmit($form, FormStateInterface $form_state) {
// Invalidate the block cache to update custom block-based derivatives.
if ($this->moduleHandler->moduleExists('block')) {
$this->configuration['view_mode'] = $form_state['values']['block_content']['view_mode'];
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index 1177ebe..c791b68 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -9,6 +9,7 @@ use Drupal\book\BookManager;
use Drupal\book\BookManagerInterface;
use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\node\NodeInterface;
@@ -159,7 +160,7 @@ function book_node_links_alter(array &$node_links, NodeInterface $node, array &$
*
* @see book_pick_book_nojs_submit()
*/
-function book_form_node_form_alter(&$form, &$form_state, $form_id) {
+function book_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$node = $form_state['controller']->getEntity();
$account = \Drupal::currentUser();
$access = $account->hasPermission('administer book outlines');
@@ -194,7 +195,7 @@ function book_form_node_form_alter(&$form, &$form_state, $form_id) {
*
* @todo: Remove this in favor of an entity field.
*/
-function book_node_builder($entity_type, NodeInterface $entity, &$form, &$form_state) {
+function book_node_builder($entity_type, NodeInterface $entity, &$form, FormStateInterface $form_state) {
$entity->book = $form_state['values']['book'];
// Always save a revision for non-administrators.
@@ -215,7 +216,7 @@ function book_node_builder($entity_type, NodeInterface $entity, &$form, &$form_s
* @see book_form_update()
* @see book_form_node_form_alter()
*/
-function book_pick_book_nojs_submit($form, &$form_state) {
+function book_pick_book_nojs_submit($form, FormStateInterface $form_state) {
$node = $form_state['controller']->getEntity();
$node->book = $form_state['values']['book'];
$form_state['rebuild'] = TRUE;
@@ -310,7 +311,7 @@ function book_node_predelete(EntityInterface $node) {
/**
* Implements hook_node_prepare_form().
*/
-function book_node_prepare_form(NodeInterface $node, $operation, array &$form_state) {
+function book_node_prepare_form(NodeInterface $node, $operation, FormStateInterface $form_state) {
/** @var \Drupal\book\BookManagerInterface $book_manager */
$book_manager = \Drupal::service('book.manager');
diff --git a/core/modules/book/src/BookManager.php b/core/modules/book/src/BookManager.php
index c491cf4..45f9adf 100644
--- a/core/modules/book/src/BookManager.php
+++ b/core/modules/book/src/BookManager.php
@@ -11,6 +11,7 @@ use Drupal\Component\Utility\Unicode;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
@@ -168,7 +169,7 @@ class BookManager implements BookManagerInterface {
/**
* {@inheritdoc}
*/
- public function addFormElements(array $form, array &$form_state, NodeInterface $node, AccountInterface $account, $collapsed = TRUE) {
+ public function addFormElements(array $form, FormStateInterface $form_state, NodeInterface $node, AccountInterface $account, $collapsed = TRUE) {
// If the form is being processed during the Ajax callback of our book bid
// dropdown, then $form_state will hold the value that was selected.
if (isset($form_state['values']['book'])) {
diff --git a/core/modules/book/src/BookManagerInterface.php b/core/modules/book/src/BookManagerInterface.php
index 81dfe08..72ca61e 100644
--- a/core/modules/book/src/BookManagerInterface.php
+++ b/core/modules/book/src/BookManagerInterface.php
@@ -7,6 +7,7 @@
namespace Drupal\book;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\NodeInterface;
@@ -203,8 +204,8 @@ interface BookManagerInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param \Drupal\node\NodeInterface $node
* The node whose form is being viewed.
* @param \Drupal\Core\Session\AccountInterface $account
@@ -215,7 +216,7 @@ interface BookManagerInterface {
* @return array
* The form structure, with the book elements added.
*/
- public function addFormElements(array $form, array &$form_state, NodeInterface $node, AccountInterface $account, $collapsed = TRUE);
+ public function addFormElements(array $form, FormStateInterface $form_state, NodeInterface $node, AccountInterface $account, $collapsed = TRUE);
/**
* Deletes node's entry from book table.
diff --git a/core/modules/book/src/Form/BookAdminEditForm.php b/core/modules/book/src/Form/BookAdminEditForm.php
index f52c2e4c..9a342f0 100644
--- a/core/modules/book/src/Form/BookAdminEditForm.php
+++ b/core/modules/book/src/Form/BookAdminEditForm.php
@@ -11,6 +11,7 @@ use Drupal\book\BookManagerInterface;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -68,7 +69,7 @@ class BookAdminEditForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, NodeInterface $node = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL) {
$form['#title'] = $node->label();
$form['#node'] = $node;
$this->bookAdminTable($node, $form);
@@ -83,7 +84,7 @@ class BookAdminEditForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
if ($form_state['values']['tree_hash'] != $form_state['values']['tree_current_hash']) {
$this->setFormError('', $form_state, $this->t('This book has been modified by another user, the changes could not be saved.'));
}
@@ -92,7 +93,7 @@ class BookAdminEditForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
// Save elements in the same order as defined in post rather than the form.
// This ensures parents are updated before their children, preventing orphans.
$order = array_flip(array_keys($form_state['input']['table']));
diff --git a/core/modules/book/src/Form/BookOutlineForm.php b/core/modules/book/src/Form/BookOutlineForm.php
index f4a97a1..82a07aa 100644
--- a/core/modules/book/src/Form/BookOutlineForm.php
+++ b/core/modules/book/src/Form/BookOutlineForm.php
@@ -10,6 +10,7 @@ namespace Drupal\book\Form;
use Drupal\book\BookManagerInterface;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -64,7 +65,7 @@ class BookOutlineForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$form['#title'] = $this->entity->label();
if (!isset($this->entity->book)) {
@@ -87,7 +88,7 @@ class BookOutlineForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- protected function actions(array $form, array &$form_state) {
+ protected function actions(array $form, FormStateInterface $form_state) {
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->entity->book['original_bid'] ? $this->t('Update book outline') : $this->t('Add to book outline');
$actions['delete']['#value'] = $this->t('Remove from book outline');
@@ -100,7 +101,7 @@ class BookOutlineForm extends ContentEntityForm {
*
* @see book_remove_button_submit()
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$form_state['redirect_route'] = array(
'route_name' => 'node.view',
'route_parameters' => array(
@@ -132,7 +133,7 @@ class BookOutlineForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function delete(array $form, array &$form_state) {
+ public function delete(array $form, FormStateInterface $form_state) {
$form_state['redirect_route'] = $this->entity->urlInfo('book-remove-form');
}
diff --git a/core/modules/book/src/Form/BookRemoveForm.php b/core/modules/book/src/Form/BookRemoveForm.php
index b24bc51..8ea7342 100644
--- a/core/modules/book/src/Form/BookRemoveForm.php
+++ b/core/modules/book/src/Form/BookRemoveForm.php
@@ -9,6 +9,7 @@ namespace Drupal\book\Form;
use Drupal\book\BookManagerInterface;
use Drupal\Core\Form\ConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -61,7 +62,7 @@ class BookRemoveForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, NodeInterface $node = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL) {
$this->node = $node;
return parent::buildForm($form, $form_state);
}
@@ -103,7 +104,7 @@ class BookRemoveForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
if ($this->bookManager->checkNodeIsRemovable($this->node)) {
$this->bookManager->deleteFromBook($this->node->id());
drupal_set_message($this->t('The post has been removed from the book.'));
diff --git a/core/modules/book/src/Form/BookSettingsForm.php b/core/modules/book/src/Form/BookSettingsForm.php
index 140f8e5..4a7535e 100644
--- a/core/modules/book/src/Form/BookSettingsForm.php
+++ b/core/modules/book/src/Form/BookSettingsForm.php
@@ -8,6 +8,7 @@
namespace Drupal\book\Form;
use Drupal\Core\Form\ConfigFormBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Configure book settings for this site.
@@ -24,7 +25,7 @@ class BookSettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$types = node_type_get_names();
$config = $this->config('book.settings');
$form['book_allowed_types'] = array(
@@ -50,7 +51,7 @@ class BookSettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
$child_type = $form_state['values']['book_child_type'];
if (empty($form_state['values']['book_allowed_types'][$child_type])) {
$this->setFormError('book_child_type', $form_state, $this->t('The content type for the %add-child link must be one of those selected as an allowed book outline type.', array('%add-child' => $this->t('Add child page'))));
@@ -62,7 +63,7 @@ class BookSettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$allowed_types = array_filter($form_state['values']['book_allowed_types']);
// We need to save the allowed types in an array ordered by machine_name so
// that we can save them in the correct order if node type changes.
diff --git a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
index 5e85d99..51d0a0d 100644
--- a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
+++ b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
@@ -9,6 +9,7 @@ namespace Drupal\book\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\book\BookManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -82,9 +83,9 @@ class BookNavigationBlock extends BlockBase implements ContainerFactoryPluginInt
}
/**
- * Overrides \Drupal\block\BlockBase::blockForm()
+ * {@inheritdoc}
*/
- function blockForm($form, &$form_state) {
+ function blockForm($form, FormStateInterface $form_state) {
$options = array(
'all pages' => t('Show block on all pages'),
'book pages' => t('Show block only on book pages'),
@@ -101,9 +102,9 @@ class BookNavigationBlock extends BlockBase implements ContainerFactoryPluginInt
}
/**
- * Overrides \Drupal\block\BlockBase::blockSubmit().
+ * {@inheritdoc}
*/
- public function blockSubmit($form, &$form_state) {
+ public function blockSubmit($form, FormStateInterface $form_state) {
$this->configuration['block_mode'] = $form_state['values']['book_block_mode'];
}
diff --git a/core/modules/ckeditor/src/CKEditorPluginConfigurableInterface.php b/core/modules/ckeditor/src/CKEditorPluginConfigurableInterface.php
index 619eb51..a5084fd 100644
--- a/core/modules/ckeditor/src/CKEditorPluginConfigurableInterface.php
+++ b/core/modules/ckeditor/src/CKEditorPluginConfigurableInterface.php
@@ -7,6 +7,7 @@
namespace Drupal\ckeditor;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\editor\Entity\Editor;
/**
@@ -36,7 +37,7 @@ interface CKEditorPluginConfigurableInterface extends CKEditorPluginInterface {
*
* @param array $form
* An empty form array to be populated with a configuration form, if any.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The state of the entire filter administration form.
* @param \Drupal\editor\Entity\Editor $editor
* A configured text editor object.
@@ -44,6 +45,6 @@ interface CKEditorPluginConfigurableInterface extends CKEditorPluginInterface {
* @return array|FALSE
* A render array for the settings form, or FALSE if there is none.
*/
- public function settingsForm(array $form, array &$form_state, Editor $editor);
+ public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor);
}
diff --git a/core/modules/ckeditor/src/CKEditorPluginManager.php b/core/modules/ckeditor/src/CKEditorPluginManager.php
index dab891d..289c906 100644
--- a/core/modules/ckeditor/src/CKEditorPluginManager.php
+++ b/core/modules/ckeditor/src/CKEditorPluginManager.php
@@ -8,6 +8,7 @@
namespace Drupal\ckeditor;
use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
@@ -147,12 +148,12 @@ class CKEditorPluginManager extends DefaultPluginManager {
*
* @param array &$form
* A reference to an associative array containing the structure of the form.
- * @param array &$form_state
- * A reference to a keyed array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param \Drupal\editor\Entity\Editor $editor
* A configured text editor object.
*/
- public function injectPluginSettingsForm(array &$form, array &$form_state, Editor $editor) {
+ public function injectPluginSettingsForm(array &$form, FormStateInterface $form_state, Editor $editor) {
$definitions = $this->getDefinitions();
foreach (array_keys($definitions) as $plugin_id) {
diff --git a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImage.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImage.php
index d9f411c..4a1329c 100644
--- a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImage.php
+++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImage.php
@@ -9,6 +9,7 @@ namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginConfigurableInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\editor\Entity\Editor;
/**
@@ -66,7 +67,7 @@ class DrupalImage extends CKEditorPluginBase implements CKEditorPluginConfigurab
* @see \Drupal\editor\Form\EditorImageDialog
* @see editor_image_upload_settings_form()
*/
- public function settingsForm(array $form, array &$form_state, Editor $editor) {
+ public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
form_load_include($form_state, 'inc', 'editor', 'editor.admin');
$form['image_upload'] = editor_image_upload_settings_form($editor);
$form['image_upload']['#attached']['library'][] = 'ckeditor/drupal.ckeditor.drupalimage.admin';
@@ -83,7 +84,7 @@ class DrupalImage extends CKEditorPluginBase implements CKEditorPluginConfigurab
* @see \Drupal\editor\Form\EditorImageDialog
* @see editor_image_upload_settings_form()
*/
- function validateImageUploadSettings(array $element, array &$form_state) {
+ function validateImageUploadSettings(array $element, FormStateInterface $form_state) {
$settings = &$form_state['values']['editor']['settings']['plugins']['drupalimage']['image_upload'];
$form_state['editor']->setImageUploadSettings($settings);
unset($form_state['values']['editor']['settings']['plugins']['drupalimage']);
diff --git a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php
index 2184cf2..963436d 100644
--- a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php
+++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php
@@ -10,6 +10,7 @@ namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginConfigurableInterface;
use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\editor\Entity\Editor;
/**
@@ -66,7 +67,7 @@ class StylesCombo extends CKEditorPluginBase implements CKEditorPluginConfigurab
/**
* Implements \Drupal\ckeditor\Plugin\CKEditorPluginConfigurableInterface::settingsForm().
*/
- public function settingsForm(array $form, array &$form_state, Editor $editor) {
+ public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
// Defaults.
$config = array('styles' => '');
$settings = $editor->getSettings();
@@ -94,7 +95,7 @@ class StylesCombo extends CKEditorPluginBase implements CKEditorPluginConfigurab
/**
* #element_validate handler for the "styles" element in settingsForm().
*/
- public function validateStylesValue(array $element, array &$form_state) {
+ public function validateStylesValue(array $element, FormStateInterface $form_state) {
if ($this->generateStylesSetSetting($element['#value']) === FALSE) {
form_error($element, $form_state, t('The provided list of styles is syntactically incorrect.'));
}
diff --git a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
index d538b60..b377f73 100644
--- a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
+++ b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
@@ -10,6 +10,7 @@ namespace Drupal\ckeditor\Plugin\Editor;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\ckeditor\CKEditorPluginManager;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Render\Element;
use Drupal\editor\Plugin\EditorBase;
@@ -127,7 +128,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state, EditorEntity $editor) {
+ public function settingsForm(array $form, FormStateInterface $form_state, EditorEntity $editor) {
$settings = $editor->getSettings();
$ckeditor_settings_toolbar = array(
@@ -234,7 +235,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
/**
* {@inheritdoc}
*/
- public function settingsFormSubmit(array $form, array &$form_state) {
+ public function settingsFormSubmit(array $form, FormStateInterface $form_state) {
// Modify the toolbar settings by reference. The values in
// $form_state['values']['editor']['settings'] will be saved directly by
// editor_form_filter_admin_format_submit().
diff --git a/core/modules/ckeditor/tests/modules/src/Plugin/CKEditorPlugin/LlamaContextualAndButton.php b/core/modules/ckeditor/tests/modules/src/Plugin/CKEditorPlugin/LlamaContextualAndButton.php
index 171e3b3..4c43cb7 100644
--- a/core/modules/ckeditor/tests/modules/src/Plugin/CKEditorPlugin/LlamaContextualAndButton.php
+++ b/core/modules/ckeditor/tests/modules/src/Plugin/CKEditorPlugin/LlamaContextualAndButton.php
@@ -11,6 +11,7 @@ use Drupal\ckeditor\CKEditorPluginButtonsInterface;
use Drupal\ckeditor\CKEditorPluginContextualInterface;
use Drupal\ckeditor\CKEditorPluginConfigurableInterface;
use Drupal\Component\Plugin\PluginBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\editor\Entity\Editor;
/**
@@ -61,7 +62,7 @@ class LlamaContextualAndButton extends Llama implements CKEditorPluginContextual
/**
* Implements \Drupal\ckeditor\Plugin\CKEditorPluginConfigurableInterface::settingsForm().
*/
- function settingsForm(array $form, array &$form_state, Editor $editor) {
+ function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
// Defaults.
$config = array('ultra_llama_mode' => FALSE);
$settings = $editor->getSettings();
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index f0137cf..1f03e18 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -9,6 +9,7 @@ use Drupal\Component\Utility\Bytes;
use Drupal\Component\Utility\Environment;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\String;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
@@ -44,7 +45,7 @@ function color_theme() {
/**
* Implements hook_form_FORM_ID_alter().
*/
-function color_form_system_theme_settings_alter(&$form, &$form_state) {
+function color_form_system_theme_settings_alter(&$form, FormStateInterface $form_state) {
if (isset($form_state['build_info']['args'][0]) && ($theme = $form_state['build_info']['args'][0]) && color_get_info($theme) && function_exists('gd_info')) {
$form['color'] = array(
'#type' => 'details',
@@ -166,7 +167,7 @@ function color_get_palette($theme, $default = FALSE) {
* @see color_scheme_form_validate()
* @see color_scheme_form_submit()
*/
-function color_scheme_form($complete_form, &$form_state, $theme) {
+function color_scheme_form($complete_form, FormStateInterface $form_state, $theme) {
$base = drupal_get_path('module', 'color');
$info = color_get_info($theme);
@@ -286,14 +287,14 @@ function template_preprocess_color_scheme_form(&$variables) {
* @param string|bool $input
* The incoming input to populate the form element. If this is FALSE,
* the element's default value should be returned.
- * @param array $form_state
- * A keyed array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return string
* The data that will appear in the $form_state['values'] collection for this
* element. Return nothing to use the default.
*/
-function color_palette_color_value($element, $input = FALSE, $form_state = array()) {
+function color_palette_color_value($element, $input = FALSE, FormStateInterface $form_state) {
// If we suspect a possible cross-site request forgery attack, only accept
// hexadecimal CSS color strings from user input, to avoid problems when this
// value is used in the JavaScript preview.
@@ -329,7 +330,7 @@ function color_valid_hexadecimal_string($color) {
*
* @see color_scheme_form_submit()
*/
-function color_scheme_form_validate($form, &$form_state) {
+function color_scheme_form_validate($form, FormStateInterface $form_state) {
// Only accept hexadecimal CSS color strings to avoid XSS upon use.
foreach ($form_state['values']['palette'] as $key => $color) {
if (!color_valid_hexadecimal_string($color)) {
@@ -343,7 +344,7 @@ function color_scheme_form_validate($form, &$form_state) {
*
* @see color_scheme_form_validate()
*/
-function color_scheme_form_submit($form, &$form_state) {
+function color_scheme_form_submit($form, FormStateInterface $form_state) {
// Get theme coloring info.
if (!isset($form_state['values']['info'])) {
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index ab0df06..d5391f3 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -18,6 +18,7 @@ use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Component\Utility\String;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\entity\Entity\EntityViewDisplay;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
@@ -749,11 +750,13 @@ function comment_user_predelete($account) {
*
* @param \Drupal\comment\CommentInterface $comment
* The comment entity to preview.
+ * @param Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
* An array as expected by drupal_render().
*/
-function comment_preview(CommentInterface $comment, array &$form_state) {
+function comment_preview(CommentInterface $comment, FormStateInterface $form_state) {
$preview_build = array();
$entity = $comment->getCommentedEntity();
diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php
index db4178d..9701e49 100644
--- a/core/modules/comment/src/CommentForm.php
+++ b/core/modules/comment/src/CommentForm.php
@@ -13,6 +13,7 @@ use Drupal\Component\Utility\Unicode;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Session\AccountInterface;
@@ -56,7 +57,7 @@ class CommentForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- protected function init(array &$form_state) {
+ protected function init(FormStateInterface $form_state) {
$comment = $this->entity;
// Make the comment inherit the current content language unless specifically
@@ -72,7 +73,7 @@ class CommentForm extends ContentEntityForm {
/**
* Overrides Drupal\Core\Entity\EntityForm::form().
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
/** @var \Drupal\comment\CommentInterface $comment */
$comment = $this->entity;
$entity = $this->entityManager->getStorage($comment->getCommentedEntityTypeId())->load($comment->getCommentedEntityId());
@@ -218,7 +219,7 @@ class CommentForm extends ContentEntityForm {
/**
* Overrides Drupal\Core\Entity\EntityForm::actions().
*/
- protected function actions(array $form, array &$form_state) {
+ protected function actions(array $form, FormStateInterface $form_state) {
$element = parent::actions($form, $form_state);
/* @var \Drupal\comment\CommentInterface $comment */
$comment = $this->entity;
@@ -255,7 +256,7 @@ class CommentForm extends ContentEntityForm {
/**
* Overrides Drupal\Core\Entity\EntityForm::validate().
*/
- public function validate(array $form, array &$form_state) {
+ public function validate(array $form, FormStateInterface $form_state) {
parent::validate($form, $form_state);
$entity = $this->entity;
@@ -289,7 +290,7 @@ class CommentForm extends ContentEntityForm {
/**
* Overrides EntityForm::buildEntity().
*/
- public function buildEntity(array $form, array &$form_state) {
+ public function buildEntity(array $form, FormStateInterface $form_state) {
$comment = parent::buildEntity($form, $form_state);
if (!empty($form_state['values']['date']) && $form_state['values']['date'] instanceOf DrupalDateTime) {
$comment->setCreatedTime($form_state['values']['date']->getTimestamp());
@@ -304,7 +305,7 @@ class CommentForm extends ContentEntityForm {
/**
* Overrides Drupal\Core\Entity\EntityForm::submit().
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
/** @var \Drupal\comment\CommentInterface $comment */
$comment = parent::submit($form, $form_state);
@@ -346,9 +347,9 @@ class CommentForm extends ContentEntityForm {
* @param $form
* An associative array containing the structure of the form.
* @param $form_state
- * A reference to a keyed array containing the current state of the form.
+ * The current state of the form.
*/
- public function preview(array &$form, array &$form_state) {
+ public function preview(array &$form, FormStateInterface $form_state) {
$comment = $this->entity;
$form_state['comment_preview'] = comment_preview($comment, $form_state);
$form_state['comment_preview']['#title'] = $this->t('Preview comment');
@@ -358,7 +359,7 @@ class CommentForm extends ContentEntityForm {
/**
* Overrides Drupal\Core\Entity\EntityForm::save().
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
$comment = $this->entity;
$entity = $comment->getCommentedEntity();
$field_name = $comment->getFieldName();
diff --git a/core/modules/comment/src/CommentTypeForm.php b/core/modules/comment/src/CommentTypeForm.php
index 43367a5..332e911 100644
--- a/core/modules/comment/src/CommentTypeForm.php
+++ b/core/modules/comment/src/CommentTypeForm.php
@@ -10,6 +10,7 @@ namespace Drupal\comment;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Form\FormStateInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -58,7 +59,7 @@ class CommentTypeForm extends EntityForm {
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$comment_type = $this->entity;
@@ -132,7 +133,7 @@ class CommentTypeForm extends EntityForm {
/**
* {@inheritdoc}
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
$comment_type = $this->entity;
$status = $comment_type->save();
diff --git a/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php
index fd8f6dc..b1d3cb7 100644
--- a/core/modules/comment/src/Form/CommentAdminOverview.php
+++ b/core/modules/comment/src/Form/CommentAdminOverview.php
@@ -14,6 +14,7 @@ use Drupal\Core\Datetime\Date as DateFormatter;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -92,15 +93,15 @@ class CommentAdminOverview extends FormBase {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param string $type
* The type of the overview form ('approval' or 'new').
*
* @return array
* The form structure.
*/
- public function buildForm(array $form, array &$form_state, $type = 'new') {
+ public function buildForm(array $form, FormStateInterface $form_state, $type = 'new') {
// Build an 'Update options' form.
$form['options'] = array(
@@ -250,7 +251,7 @@ class CommentAdminOverview extends FormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
$form_state['values']['comments'] = array_diff($form_state['values']['comments'], array(0));
// We can't execute any 'Update options' if no comments were selected.
if (count($form_state['values']['comments']) == 0) {
@@ -261,7 +262,7 @@ class CommentAdminOverview extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$operation = $form_state['values']['operation'];
$cids = $form_state['values']['comments'];
diff --git a/core/modules/comment/src/Form/CommentTypeDeleteForm.php b/core/modules/comment/src/Form/CommentTypeDeleteForm.php
index 85092db..64da7c4 100644
--- a/core/modules/comment/src/Form/CommentTypeDeleteForm.php
+++ b/core/modules/comment/src/Form/CommentTypeDeleteForm.php
@@ -11,6 +11,7 @@ use Drupal\comment\CommentManagerInterface;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\field\Entity\FieldStorageConfig;
use Psr\Log\LoggerInterface;
@@ -111,7 +112,7 @@ class CommentTypeDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$comments = $this->queryFactory->get('comment')->condition('comment_type', $this->entity->id())->execute();
$entity_type = $this->entity->getTargetEntityTypeId();
$caption = '';
@@ -140,7 +141,7 @@ class CommentTypeDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$this->entity->delete();
$form_state['redirect_route']['route_name'] = 'comment.type_list';
drupal_set_message($this->t('Comment type %label has been deleted.', array('%label' => $this->entity->label())));
diff --git a/core/modules/comment/src/Form/ConfirmDeleteMultiple.php b/core/modules/comment/src/Form/ConfirmDeleteMultiple.php
index 5a0b062..39fe538 100644
--- a/core/modules/comment/src/Form/ConfirmDeleteMultiple.php
+++ b/core/modules/comment/src/Form/ConfirmDeleteMultiple.php
@@ -10,6 +10,7 @@ namespace Drupal\comment\Form;
use Drupal\comment\CommentStorageInterface;
use Drupal\Component\Utility\String;
use Drupal\Core\Form\ConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -82,7 +83,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$edit = $form_state['input'];
$form['comments'] = array(
@@ -116,7 +117,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
if ($form_state['values']['confirm']) {
$this->commentStorage->delete($this->comments);
$count = count($form_state['values']['comments']);
diff --git a/core/modules/comment/src/Form/DeleteForm.php b/core/modules/comment/src/Form/DeleteForm.php
index b8cbae6..1ee7b4c 100644
--- a/core/modules/comment/src/Form/DeleteForm.php
+++ b/core/modules/comment/src/Form/DeleteForm.php
@@ -8,6 +8,7 @@
namespace Drupal\comment\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Provides the comment delete confirmation form.
@@ -46,7 +47,7 @@ class DeleteForm extends ContentEntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
// Delete the comment and its replies.
$this->entity->delete();
drupal_set_message($this->t('The comment and all its replies have been deleted.'));
diff --git a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php
index ad59c96..87ec9e7 100644
--- a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php
+++ b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php
@@ -10,6 +10,7 @@ namespace Drupal\comment\Plugin\Action;
use Drupal\Component\Utility\Tags;
use Drupal\Core\Action\ConfigurableActionBase;
use Drupal\comment\CommentInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Unpublishes a comment containing certain keywords.
@@ -49,7 +50,7 @@ class UnpublishByKeywordComment extends ConfigurableActionBase {
/**
* {@inheritdoc}
*/
- public function buildConfigurationForm(array $form, array &$form_state) {
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['keywords'] = array(
'#title' => t('Keywords'),
'#type' => 'textarea',
@@ -62,7 +63,7 @@ class UnpublishByKeywordComment extends ConfigurableActionBase {
/**
* {@inheritdoc}
*/
- public function submitConfigurationForm(array &$form, array &$form_state) {
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['keywords'] = Tags::explode($form_state['values']['keywords']);
}
diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
index be7bf53..e5ad723 100644
--- a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
+++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
@@ -13,6 +13,7 @@ use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Entity\EntityViewBuilderInterface;
use Drupal\Core\Entity\EntityFormBuilderInterface;
use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FormatterBase;
@@ -232,7 +233,7 @@ class CommentDefaultFormatter extends FormatterBase implements ContainerFactoryP
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element = array();
$element['pager_id'] = array(
'#type' => 'select',
diff --git a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
index 33a88b5..57e41d8 100644
--- a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
+++ b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
@@ -10,6 +10,7 @@ namespace Drupal\comment\Plugin\Field\FieldType;
use Drupal\comment\CommentManagerInterface;
use Drupal\comment\Entity\CommentType;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\TypedData\DataDefinition;
use Drupal\Core\Field\FieldItemBase;
use Drupal\Core\Session\AnonymousUserSession;
@@ -98,7 +99,7 @@ class CommentItem extends FieldItemBase implements CommentItemInterface {
/**
* {@inheritdoc}
*/
- public function instanceSettingsForm(array $form, array &$form_state) {
+ public function instanceSettingsForm(array $form, FormStateInterface $form_state) {
$element = array();
$settings = $this->getSettings();
@@ -188,7 +189,7 @@ class CommentItem extends FieldItemBase implements CommentItemInterface {
/**
* {@inheritdoc}
*/
- public function settingsForm(array &$form, array &$form_state, $has_data) {
+ public function settingsForm(array &$form, FormStateInterface $form_state, $has_data) {
$element = array();
// @todo Inject entity storage once typed-data supports container injection.
diff --git a/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php b/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
index f9fdf73..87309c5 100644
--- a/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
+++ b/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
@@ -10,6 +10,7 @@ namespace Drupal\comment\Plugin\Field\FieldWidget;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Provides a default comment widget.
@@ -27,7 +28,7 @@ class CommentWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$entity = $items->getEntity();
$element['status'] = array(
@@ -89,7 +90,7 @@ class CommentWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function massageFormValues(array $values, array $form, array &$form_state) {
+ public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
// Add default values for statistics properties because we don't want to
// have them in form.
foreach ($values as &$value) {
diff --git a/core/modules/comment/src/Plugin/views/field/Comment.php b/core/modules/comment/src/Plugin/views/field/Comment.php
index 1a47a4a..25c001d 100644
--- a/core/modules/comment/src/Plugin/views/field/Comment.php
+++ b/core/modules/comment/src/Plugin/views/field/Comment.php
@@ -7,6 +7,7 @@
namespace Drupal\comment\Plugin\views\field;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\ResultRow;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
@@ -60,7 +61,7 @@ class Comment extends FieldPluginBase {
/**
* Provide link-to-comment option
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['link_to_comment'] = array(
'#title' => t('Link this field to its comment'),
'#description' => t("Enable to override this field's links."),
diff --git a/core/modules/comment/src/Plugin/views/field/EntityLink.php b/core/modules/comment/src/Plugin/views/field/EntityLink.php
index f848210..c1dae39 100644
--- a/core/modules/comment/src/Plugin/views/field/EntityLink.php
+++ b/core/modules/comment/src/Plugin/views/field/EntityLink.php
@@ -7,6 +7,7 @@
namespace Drupal\comment\Plugin\views\field;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
@@ -32,7 +33,7 @@ class EntityLink extends FieldPluginBase {
return $options;
}
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['teaser'] = array(
'#type' => 'checkbox',
'#title' => t('Show teaser-style link'),
diff --git a/core/modules/comment/src/Plugin/views/field/Link.php b/core/modules/comment/src/Plugin/views/field/Link.php
index a57ff12..4a3842e 100644
--- a/core/modules/comment/src/Plugin/views/field/Link.php
+++ b/core/modules/comment/src/Plugin/views/field/Link.php
@@ -8,6 +8,7 @@
namespace Drupal\comment\Plugin\views\field;
use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\views\ResultRow;
@@ -65,7 +66,7 @@ class Link extends FieldPluginBase {
return $options;
}
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['text'] = array(
'#type' => 'textfield',
'#title' => t('Text to display'),
diff --git a/core/modules/comment/src/Plugin/views/field/LinkEdit.php b/core/modules/comment/src/Plugin/views/field/LinkEdit.php
index f6137ad..7637143 100644
--- a/core/modules/comment/src/Plugin/views/field/LinkEdit.php
+++ b/core/modules/comment/src/Plugin/views/field/LinkEdit.php
@@ -7,6 +7,7 @@
namespace Drupal\comment\Plugin\views\field;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\ResultRow;
/**
@@ -25,7 +26,7 @@ class LinkEdit extends Link {
return $options;
}
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['destination'] = array(
diff --git a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
index 3366157..748291b 100644
--- a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
+++ b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
@@ -9,6 +9,7 @@ namespace Drupal\comment\Plugin\views\field;
use Drupal\Core\Database\Connection;
use Drupal\comment\CommentInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\Numeric;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ResultRow;
@@ -82,7 +83,7 @@ class NodeNewComments extends Numeric {
return $options;
}
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['link_to_comment'] = array(
'#title' => t('Link this field to new comments'),
'#description' => t("Enable to override this field's links."),
diff --git a/core/modules/comment/src/Plugin/views/field/Username.php b/core/modules/comment/src/Plugin/views/field/Username.php
index c400144..b526dbc 100644
--- a/core/modules/comment/src/Plugin/views/field/Username.php
+++ b/core/modules/comment/src/Plugin/views/field/Username.php
@@ -7,6 +7,7 @@
namespace Drupal\comment\Plugin\views\field;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\ResultRow;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
@@ -39,7 +40,7 @@ class Username extends FieldPluginBase {
return $options;
}
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['link_to_user'] = array(
'#title' => t("Link this field to its user or an author's homepage"),
'#type' => 'checkbox',
diff --git a/core/modules/comment/src/Plugin/views/row/CommentRow.php b/core/modules/comment/src/Plugin/views/row/CommentRow.php
index 2d34728..5256b56 100644
--- a/core/modules/comment/src/Plugin/views/row/CommentRow.php
+++ b/core/modules/comment/src/Plugin/views/row/CommentRow.php
@@ -7,6 +7,7 @@
namespace Drupal\comment\Plugin\views\row;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\row\EntityRow;
/**
@@ -31,7 +32,7 @@ class CommentRow extends EntityRow {
/**
* {@inheritdoc}
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['links'] = array(
diff --git a/core/modules/comment/src/Plugin/views/row/Rss.php b/core/modules/comment/src/Plugin/views/row/Rss.php
index 8b8fc4a..d24eefe 100644
--- a/core/modules/comment/src/Plugin/views/row/Rss.php
+++ b/core/modules/comment/src/Plugin/views/row/Rss.php
@@ -7,6 +7,7 @@
namespace Drupal\comment\Plugin\views\row;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\row\RowPluginBase;
/**
@@ -36,7 +37,7 @@ class Rss extends RowPluginBase {
return $options;
}
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['view_mode'] = array(
diff --git a/core/modules/comment/src/Plugin/views/wizard/Comment.php b/core/modules/comment/src/Plugin/views/wizard/Comment.php
index c2c4ff4..5227f39 100644
--- a/core/modules/comment/src/Plugin/views/wizard/Comment.php
+++ b/core/modules/comment/src/Plugin/views/wizard/Comment.php
@@ -7,6 +7,7 @@
namespace Drupal\comment\Plugin\views\wizard;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
/**
@@ -73,7 +74,7 @@ class Comment extends WizardPluginBase {
return $options;
}
- protected function buildFormStyle(array &$form, array &$form_state, $type) {
+ protected function buildFormStyle(array &$form, FormStateInterface $form_state, $type) {
parent::buildFormStyle($form, $form_state, $type);
$style_form =& $form['displays'][$type]['options']['style'];
// Some style plugins don't support row plugins so stop here if that's the
@@ -101,7 +102,7 @@ class Comment extends WizardPluginBase {
/**
* {@inheritdoc}
*/
- protected function pageDisplayOptions(array $form, array &$form_state) {
+ protected function pageDisplayOptions(array $form, FormStateInterface $form_state) {
$display_options = parent::pageDisplayOptions($form, $form_state);
$row_plugin = isset($form_state['values']['page']['style']['row_plugin']) ? $form_state['values']['page']['style']['row_plugin'] : NULL;
$row_options = isset($form_state['values']['page']['style']['row_options']) ? $form_state['values']['page']['style']['row_options'] : array();
@@ -112,7 +113,7 @@ class Comment extends WizardPluginBase {
/**
* Overrides Drupal\views\Plugin\views\wizard\WizardPluginBase::blockDisplayOptions().
*/
- protected function blockDisplayOptions(array $form, array &$form_state) {
+ protected function blockDisplayOptions(array $form, FormStateInterface $form_state) {
$display_options = parent::blockDisplayOptions($form, $form_state);
$row_plugin = isset($form_state['values']['block']['style']['row_plugin']) ? $form_state['values']['block']['style']['row_plugin'] : NULL;
$row_options = isset($form_state['values']['block']['style']['row_options']) ? $form_state['values']['block']['style']['row_options'] : array();
diff --git a/core/modules/config/src/Form/ConfigExportForm.php b/core/modules/config/src/Form/ConfigExportForm.php
index c351818..e76a56c 100644
--- a/core/modules/config/src/Form/ConfigExportForm.php
+++ b/core/modules/config/src/Form/ConfigExportForm.php
@@ -8,6 +8,7 @@
namespace Drupal\config\Form;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Defines the configuration export form.
@@ -24,7 +25,7 @@ class ConfigExportForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form['description'] = array(
'#markup' => '<p>' . $this->t('Use the export button below to download your site configuration.') . '</p>',
);
@@ -38,7 +39,7 @@ class ConfigExportForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$form_state['redirect_route']['route_name'] = 'config.export_download';
}
diff --git a/core/modules/config/src/Form/ConfigImportForm.php b/core/modules/config/src/Form/ConfigImportForm.php
index 97d039e..00315e1 100644
--- a/core/modules/config/src/Form/ConfigImportForm.php
+++ b/core/modules/config/src/Form/ConfigImportForm.php
@@ -10,6 +10,7 @@ namespace Drupal\config\Form;
use Drupal\Core\Archiver\ArchiveTar;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -53,7 +54,7 @@ class ConfigImportForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form['description'] = array(
'#markup' => '<p>' . $this->t('Use the upload button below.') . '</p>',
);
@@ -73,7 +74,7 @@ class ConfigImportForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
$file_upload = $this->getRequest()->files->get('files[import_tarball]', NULL, TRUE);
if ($file_upload && $file_upload->isValid()) {
$form_state['values']['import_tarball'] = $file_upload->getRealPath();
@@ -86,7 +87,7 @@ class ConfigImportForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
if ($path = $form_state['values']['import_tarball']) {
$this->configStorage->deleteAll();
try {
diff --git a/core/modules/config/src/Form/ConfigSingleExportForm.php b/core/modules/config/src/Form/ConfigSingleExportForm.php
index 14255b5..28d1069 100644
--- a/core/modules/config/src/Form/ConfigSingleExportForm.php
+++ b/core/modules/config/src/Form/ConfigSingleExportForm.php
@@ -12,6 +12,8 @@ use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormState;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -73,7 +75,7 @@ class ConfigSingleExportForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, $config_type = NULL, $config_name = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, $config_type = NULL, $config_name = NULL) {
foreach ($this->entityManager->getDefinitions() as $entity_type => $definition) {
if ($definition->isSubclassOf('Drupal\Core\Config\Entity\ConfigEntityInterface')) {
$this->definitions[$entity_type] = $definition;
@@ -121,10 +123,10 @@ class ConfigSingleExportForm extends FormBase {
'#suffix' => '</div>',
);
if ($config_type && $config_name) {
- $fake_form_state = array('values' => array(
+ $fake_form_state = new FormState(array('values' => array(
'config_type' => $config_type,
'config_name' => $config_name,
- ));
+ )));
$form['export'] = $this->updateExport($form, $fake_form_state);
}
return $form;
@@ -133,7 +135,7 @@ class ConfigSingleExportForm extends FormBase {
/**
* Handles switching the configuration type selector.
*/
- public function updateConfigurationType($form, &$form_state) {
+ public function updateConfigurationType($form, FormStateInterface $form_state) {
$form['config_name']['#options'] = $this->findConfiguration($form_state['values']['config_type']);
return $form['config_name'];
}
@@ -141,7 +143,7 @@ class ConfigSingleExportForm extends FormBase {
/**
* Handles switching the export textarea.
*/
- public function updateExport($form, &$form_state) {
+ public function updateExport($form, FormStateInterface $form_state) {
// Determine the full config name for the selected config entity.
if ($form_state['values']['config_type'] !== 'system.simple') {
$definition = $this->entityManager->getDefinition($form_state['values']['config_type']);
@@ -197,7 +199,7 @@ class ConfigSingleExportForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
// Nothing to submit.
}
diff --git a/core/modules/config/src/Form/ConfigSingleImportForm.php b/core/modules/config/src/Form/ConfigSingleImportForm.php
index 0793c58..faff0e9 100644
--- a/core/modules/config/src/Form/ConfigSingleImportForm.php
+++ b/core/modules/config/src/Form/ConfigSingleImportForm.php
@@ -11,6 +11,7 @@ use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\ConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -114,7 +115,7 @@ class ConfigSingleImportForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
// When this is the confirmation step fall through to the confirmation form.
if ($this->data) {
return parent::buildForm($form, $form_state);
@@ -177,7 +178,7 @@ class ConfigSingleImportForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
// The confirmation step needs no additional validation.
if ($this->data) {
return;
@@ -232,7 +233,7 @@ class ConfigSingleImportForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
// If this form has not yet been confirmed, store the values and rebuild.
if (!$this->data) {
$form_state['rebuild'] = TRUE;
diff --git a/core/modules/config/src/Form/ConfigSync.php b/core/modules/config/src/Form/ConfigSync.php
index 7c48dd5..a93c0ff 100644
--- a/core/modules/config/src/Form/ConfigSync.php
+++ b/core/modules/config/src/Form/ConfigSync.php
@@ -17,6 +17,7 @@ use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Config\StorageInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Lock\LockBackendInterface;
use Drupal\Core\Config\StorageComparer;
use Drupal\Core\Routing\UrlGeneratorInterface;
@@ -152,7 +153,7 @@ class ConfigSync extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
@@ -270,7 +271,7 @@ class ConfigSync extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$config_importer = new ConfigImporter(
$form_state['storage_comparer'],
$this->eventDispatcher,
diff --git a/core/modules/config/tests/config_test/src/ConfigTestForm.php b/core/modules/config/tests/config_test/src/ConfigTestForm.php
index 8a680b2..cbe4c6f 100644
--- a/core/modules/config/tests/config_test/src/ConfigTestForm.php
+++ b/core/modules/config/tests/config_test/src/ConfigTestForm.php
@@ -8,6 +8,7 @@
namespace Drupal\config_test;
use Drupal\Core\Entity\EntityForm;
+use Drupal\Core\Form\FormStateInterface;
/**
* Form controller for the test config edit forms.
@@ -15,9 +16,9 @@ use Drupal\Core\Entity\EntityForm;
class ConfigTestForm extends EntityForm {
/**
- * Overrides Drupal\Core\Entity\EntityForm::form().
+ * {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$entity = $this->entity;
@@ -67,9 +68,9 @@ class ConfigTestForm extends EntityForm {
}
/**
- * Overrides Drupal\Core\Entity\EntityForm::save().
+ * {@inheritdoc}
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$status = $entity->save();
diff --git a/core/modules/config/tests/config_test/src/Form/ConfigTestDeleteForm.php b/core/modules/config/tests/config_test/src/Form/ConfigTestDeleteForm.php
index 63cdfd6..d344a4e 100644
--- a/core/modules/config/tests/config_test/src/Form/ConfigTestDeleteForm.php
+++ b/core/modules/config/tests/config_test/src/Form/ConfigTestDeleteForm.php
@@ -8,6 +8,7 @@ namespace Drupal\config_test\Form;
use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
@@ -39,7 +40,7 @@ class ConfigTestDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message(String::format('%label configuration has been deleted.', array('%label' => $this->entity->label())));
$form_state['redirect_route'] = $this->getCancelUrl();
diff --git a/core/modules/config_translation/src/Form/ConfigTranslationAddForm.php b/core/modules/config_translation/src/Form/ConfigTranslationAddForm.php
index 9556be2..1930c3b 100644
--- a/core/modules/config_translation/src/Form/ConfigTranslationAddForm.php
+++ b/core/modules/config_translation/src/Form/ConfigTranslationAddForm.php
@@ -7,6 +7,7 @@
namespace Drupal\config_translation\Form;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -24,7 +25,7 @@ class ConfigTranslationAddForm extends ConfigTranslationFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, Request $request = NULL, $plugin_id = NULL, $langcode = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL, $plugin_id = NULL, $langcode = NULL) {
$form = parent::buildForm($form, $form_state, $request, $plugin_id, $langcode);
$form['#title'] = $this->t('Add @language translation for %label', array(
'%label' => $this->mapper->getTitle(),
@@ -36,7 +37,7 @@ class ConfigTranslationAddForm extends ConfigTranslationFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
drupal_set_message($this->t('Successfully saved @language translation.', array('@language' => $this->language->name)));
}
diff --git a/core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php b/core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php
index e064b1a..fc9c730 100644
--- a/core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php
+++ b/core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php
@@ -11,6 +11,7 @@ use Drupal\config_translation\ConfigMapperManagerInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\ConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\language\ConfigurableLanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -115,7 +116,7 @@ class ConfigTranslationDeleteForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, Request $request = NULL, $plugin_id = NULL, $langcode = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL, $plugin_id = NULL, $langcode = NULL) {
/** @var \Drupal\config_translation\ConfigMapperInterface $mapper */
$mapper = $this->configMapperManager->createInstance($plugin_id);
$mapper->populateFromRequest($request);
@@ -133,7 +134,7 @@ class ConfigTranslationDeleteForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
foreach ($this->mapper->getConfigNames() as $name) {
$this->languageManager->getLanguageConfigOverride($this->language->id, $name)->delete();
}
diff --git a/core/modules/config_translation/src/Form/ConfigTranslationEditForm.php b/core/modules/config_translation/src/Form/ConfigTranslationEditForm.php
index 565d07a..91e4797 100644
--- a/core/modules/config_translation/src/Form/ConfigTranslationEditForm.php
+++ b/core/modules/config_translation/src/Form/ConfigTranslationEditForm.php
@@ -7,6 +7,7 @@
namespace Drupal\config_translation\Form;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -24,7 +25,7 @@ class ConfigTranslationEditForm extends ConfigTranslationFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, Request $request = NULL, $plugin_id = NULL, $langcode = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL, $plugin_id = NULL, $langcode = NULL) {
$form = parent::buildForm($form, $form_state, $request, $plugin_id, $langcode);
$form['#title'] = $this->t('Edit @language translation for %label', array(
'%label' => $this->mapper->getTitle(),
@@ -36,7 +37,7 @@ class ConfigTranslationEditForm extends ConfigTranslationFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
drupal_set_message($this->t('Successfully updated @language translation.', array('@language' => $this->language->name)));
}
diff --git a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php
index 5b6125a..29ed2c9 100644
--- a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php
+++ b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php
@@ -14,6 +14,7 @@ use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\BaseFormIdInterface;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\language\Config\LanguageConfigOverride;
use Drupal\language\ConfigurableLanguageManagerInterface;
@@ -138,8 +139,8 @@ abstract class ConfigTranslationFormBase extends FormBase implements BaseFormIdI
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * An associative array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param \Symfony\Component\HttpFoundation\Request $request
* (optional) Page request object.
* @param string $plugin_id
@@ -155,7 +156,7 @@ abstract class ConfigTranslationFormBase extends FormBase implements BaseFormIdI
* Throws an exception if the language code provided as a query parameter in
* the request does not match an active language.
*/
- public function buildForm(array $form, array &$form_state, Request $request = NULL, $plugin_id = NULL, $langcode = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL, $plugin_id = NULL, $langcode = NULL) {
/** @var \Drupal\config_translation\ConfigMapperInterface $mapper */
$mapper = $this->configMapperManager->createInstance($plugin_id);
$mapper->populateFromRequest($request);
@@ -214,7 +215,7 @@ abstract class ConfigTranslationFormBase extends FormBase implements BaseFormIdI
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$form_values = $form_state['values']['config_names'];
// For the form submission handling, use the raw data.
diff --git a/core/modules/config_translation/src/FormElement/DateFormat.php b/core/modules/config_translation/src/FormElement/DateFormat.php
index 2e089cb..d00a71e 100644
--- a/core/modules/config_translation/src/FormElement/DateFormat.php
+++ b/core/modules/config_translation/src/FormElement/DateFormat.php
@@ -10,6 +10,7 @@ namespace Drupal\config_translation\FormElement;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ReplaceCommand;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\TypedData\DataDefinitionInterface;
@@ -46,7 +47,7 @@ class DateFormat implements ElementInterface {
*
* @param array $form
* Form API array structure.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* Form state information.
*
* @return AjaxResponse
@@ -54,7 +55,7 @@ class DateFormat implements ElementInterface {
* the given format cannot be identified or was empty, the response will
* be empty as well.
*/
- public static function ajaxSample(array $form, array $form_state) {
+ public static function ajaxSample(array $form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$format_value = NestedArray::getValue($form_state['values'], $form_state['triggering_element']['#array_parents']);
diff --git a/core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module b/core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module
index d38be97..582be7c 100644
--- a/core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module
+++ b/core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module
@@ -6,6 +6,7 @@
*/
use Drupal\Core\Extension\Extension;
+use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_system_info_alter().
@@ -47,7 +48,7 @@ function config_translation_test_config_translation_info_alter(&$info) {
*
* @see \Drupal\config_translation\Form\ConfigTranslationFormBase
*/
-function config_translation_test_form_config_translation_form_alter(&$form, &$form_state) {
+function config_translation_test_form_config_translation_form_alter(&$form, FormStateInterface $form_state) {
if (\Drupal::state()->get('config_translation_test_alter_form_alter')) {
$form['#base_altered'] = TRUE;
}
@@ -60,7 +61,7 @@ function config_translation_test_form_config_translation_form_alter(&$form, &$fo
*
* @see \Drupal\config_translation\Form\ConfigTranslationAddForm
*/
-function config_translation_test_form_config_translation_add_form_alter(&$form, &$form_state) {
+function config_translation_test_form_config_translation_add_form_alter(&$form, FormStateInterface $form_state) {
if (\Drupal::state()->get('config_translation_test_alter_form_alter')) {
$form['#altered'] = TRUE;
}
@@ -77,7 +78,7 @@ function config_translation_test_form_config_translation_add_form_alter(&$form,
*
* @see \Drupal\config_translation\Form\ConfigTranslationEditForm
*/
-function config_translation_test_form_config_translation_edit_form_alter(&$form, &$form_state) {
+function config_translation_test_form_config_translation_edit_form_alter(&$form, FormStateInterface $form_state) {
if (\Drupal::state()->get('config_translation_test_alter_form_alter')) {
$form['#altered'] = TRUE;
}
diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module
index e8485c1..bee5dcf 100644
--- a/core/modules/contact/contact.module
+++ b/core/modules/contact/contact.module
@@ -5,6 +5,7 @@
* Enables the use of personal and site-wide contact forms.
*/
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
@@ -162,7 +163,7 @@ function contact_mail($key, &$message, $params) {
*
* @see \Drupal\user\ProfileForm::form()
*/
-function contact_form_user_form_alter(&$form, &$form_state) {
+function contact_form_user_form_alter(&$form, FormStateInterface $form_state) {
$form['contact'] = array(
'#type' => 'details',
'#title' => t('Contact settings'),
@@ -185,7 +186,7 @@ function contact_form_user_form_alter(&$form, &$form_state) {
/**
* Submit callback for the user profile form to save the contact page setting.
*/
-function contact_user_profile_form_submit($form, &$form_state) {
+function contact_user_profile_form_submit($form, FormStateInterface $form_state) {
$account = $form_state['controller']->getEntity();
if ($account->id() && isset($form_state['values']['contact'])) {
\Drupal::service('user.data')->set('contact', $account->id(), 'enabled', (int) $form_state['values']['contact']);
@@ -199,7 +200,7 @@ function contact_user_profile_form_submit($form, &$form_state) {
*
* @see user_admin_settings()
*/
-function contact_form_user_admin_settings_alter(&$form, &$form_state) {
+function contact_form_user_admin_settings_alter(&$form, FormStateInterface $form_state) {
$form['contact'] = array(
'#type' => 'details',
'#title' => t('Contact settings'),
@@ -221,7 +222,7 @@ function contact_form_user_admin_settings_alter(&$form, &$form_state) {
*
* @see contact_form_user_admin_settings_alter()
*/
-function contact_form_user_admin_settings_submit($form, &$form_state) {
+function contact_form_user_admin_settings_submit($form, FormStateInterface $form_state) {
\Drupal::config('contact.settings')
->set('user_default_enabled', $form_state['values']['contact_default_status'])
->save();
diff --git a/core/modules/contact/src/CategoryForm.php b/core/modules/contact/src/CategoryForm.php
index fd315a6..df91084 100644
--- a/core/modules/contact/src/CategoryForm.php
+++ b/core/modules/contact/src/CategoryForm.php
@@ -9,6 +9,7 @@ namespace Drupal\contact;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Base form for category edit forms.
@@ -18,7 +19,7 @@ class CategoryForm extends EntityForm {
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$category = $this->entity;
@@ -72,7 +73,7 @@ class CategoryForm extends EntityForm {
/**
* {@inheritdoc}
*/
- public function validate(array $form, array &$form_state) {
+ public function validate(array $form, FormStateInterface $form_state) {
parent::validate($form, $form_state);
// Validate and each email recipient.
@@ -90,7 +91,7 @@ class CategoryForm extends EntityForm {
/**
* {@inheritdoc}
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
$category = $this->entity;
$status = $category->save();
$contact_settings = $this->config('contact.settings');
diff --git a/core/modules/contact/src/Form/CategoryDeleteForm.php b/core/modules/contact/src/Form/CategoryDeleteForm.php
index 9117a75..5fddb08 100644
--- a/core/modules/contact/src/Form/CategoryDeleteForm.php
+++ b/core/modules/contact/src/Form/CategoryDeleteForm.php
@@ -8,6 +8,7 @@
namespace Drupal\contact\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
@@ -39,7 +40,7 @@ class CategoryDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message($this->t('Category %label has been deleted.', array('%label' => $this->entity->label())));
watchdog('contact', 'Category %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE);
diff --git a/core/modules/contact/src/MessageForm.php b/core/modules/contact/src/MessageForm.php
index d289f38..30ac410 100644
--- a/core/modules/contact/src/MessageForm.php
+++ b/core/modules/contact/src/MessageForm.php
@@ -11,6 +11,7 @@ use Drupal\Component\Utility\String;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Flood\FloodInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Language\LanguageManagerInterface;
@@ -72,7 +73,7 @@ class MessageForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$user = $this->currentUser();
$message = $this->entity;
$form = parent::form($form, $form_state, $message);
@@ -150,7 +151,7 @@ class MessageForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function actions(array $form, array &$form_state) {
+ public function actions(array $form, FormStateInterface $form_state) {
$elements = parent::actions($form, $form_state);
$elements['submit']['#value'] = $this->t('Send message');
$elements['preview'] = array(
@@ -169,7 +170,7 @@ class MessageForm extends ContentEntityForm {
/**
* Form submission handler for the 'preview' action.
*/
- public function preview(array $form, array &$form_state) {
+ public function preview(array $form, FormStateInterface $form_state) {
$message = $this->entity;
$message->preview = TRUE;
$form_state['rebuild'] = TRUE;
@@ -178,7 +179,7 @@ class MessageForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
$user = $this->currentUser();
$language_interface = $this->languageManager->getCurrentLanguage();
@@ -271,7 +272,7 @@ class MessageForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
- protected function init(array &$form_state) {
+ protected function init(FormStateInterface $form_state) {
$message = $this->entity;
// Make the message inherit the current content language unless specifically
diff --git a/core/modules/contact/src/Plugin/views/field/ContactLink.php b/core/modules/contact/src/Plugin/views/field/ContactLink.php
index 15313e0..8b0ce91 100644
--- a/core/modules/contact/src/Plugin/views/field/ContactLink.php
+++ b/core/modules/contact/src/Plugin/views/field/ContactLink.php
@@ -9,6 +9,7 @@ namespace Drupal\contact\Plugin\views\field;
use Drupal\Core\Access\AccessManagerInterface;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\user\Plugin\views\field\Link;
use Drupal\views\ResultRow;
@@ -84,7 +85,7 @@ class ContactLink extends Link {
/**
* {@inheritdoc}
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['text']['#title'] = t('Link label');
$form['text']['#required'] = TRUE;
diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc
index 7e7e790..9b33f0e 100644
--- a/core/modules/content_translation/content_translation.admin.inc
+++ b/core/modules/content_translation/content_translation.admin.inc
@@ -8,6 +8,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Render\Element;
use Drupal\field\FieldInstanceConfigInterface;
@@ -60,7 +61,7 @@ function content_translation_field_sync_widget(FieldDefinitionInterface $field)
/**
* (proxied) Implements hook_form_FORM_ID_alter().
*/
-function _content_translation_form_language_content_settings_form_alter(array &$form, array &$form_state) {
+function _content_translation_form_language_content_settings_form_alter(array &$form, FormStateInterface $form_state) {
// Inject into the content language settings the translation settings if the
// user has the required permission.
if (!\Drupal::currentUser()->hasPermission('administer content translation')) {
@@ -254,7 +255,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
*
* @see content_translation_admin_settings_form_submit()
*/
-function content_translation_form_language_content_settings_validate(array $form, array &$form_state) {
+function content_translation_form_language_content_settings_validate(array $form, FormStateInterface $form_state) {
$settings = &$form_state['values']['settings'];
foreach ($settings as $entity_type => $entity_settings) {
foreach ($entity_settings as $bundle => $bundle_settings) {
@@ -284,7 +285,7 @@ function content_translation_form_language_content_settings_validate(array $form
*
* @see content_translation_admin_settings_form_validate()
*/
-function content_translation_form_language_content_settings_submit(array $form, array &$form_state) {
+function content_translation_form_language_content_settings_submit(array $form, FormStateInterface $form_state) {
$entity_types = $form_state['values']['entity_types'];
$settings = &$form_state['values']['settings'];
diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module
index 21144a5..c79213a 100644
--- a/core/modules/content_translation/content_translation.module
+++ b/core/modules/content_translation/content_translation.module
@@ -9,6 +9,7 @@ use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityFormInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\field\Entity\FieldInstanceConfig;
@@ -366,8 +367,8 @@ function content_translation_controller($entity_type_id) {
/**
* Returns the entity form for the given form.
*
- * @param array $form_state
- * The form state array holding the entity form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current form state holding the entity form.
*
* @return \Drupal\Core\Entity\EntityFormInterface;
* An instance of the content translation form interface or FALSE if not an
@@ -375,7 +376,7 @@ function content_translation_controller($entity_type_id) {
*
* @todo Move to \Drupal\content_translation\ContentTranslationManager.
*/
-function content_translation_form_controller(array $form_state) {
+function content_translation_form_controller($form_state) {
return isset($form_state['controller']) && $form_state['controller'] instanceof EntityFormInterface ? $form_state['controller'] : FALSE;
}
@@ -458,7 +459,7 @@ function content_translation_permission() {
/**
* Implements hook_form_alter().
*/
-function content_translation_form_alter(array &$form, array &$form_state) {
+function content_translation_form_alter(array &$form, FormStateInterface $form_state) {
$form_controller = content_translation_form_controller($form_state);
$entity = $form_controller ? $form_controller->getEntity() : NULL;
@@ -644,7 +645,7 @@ function content_translation_entity_extra_field_info() {
/**
* Implements hook_form_FORM_ID_alter() for 'field_ui_instance_edit_form'.
*/
-function content_translation_form_field_ui_field_instance_edit_form_alter(array &$form, array &$form_state) {
+function content_translation_form_field_ui_field_instance_edit_form_alter(array &$form, FormStateInterface $form_state) {
$instance = $form_state['instance'];
$bundle_is_translatable = content_translation_enabled($instance->entity_type, $instance->bundle);
@@ -722,10 +723,10 @@ function content_translation_element_info_alter(&$type) {
* The bundle of the entity being configured for translation.
* @param array $form
* The configuration form array.
- * @param array $form_state
- * The configuration form state array.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
-function content_translation_enable_widget($entity_type, $bundle, array &$form, array &$form_state) {
+function content_translation_enable_widget($entity_type, $bundle, array &$form, FormStateInterface $form_state) {
$key = $form_state['content_translation']['key'];
if (!isset($form_state['language'][$key])) {
$form_state['language'][$key] = array();
@@ -745,7 +746,7 @@ function content_translation_enable_widget($entity_type, $bundle, array &$form,
* @return
* Processed language configuration element.
*/
-function content_translation_language_configuration_element_process(array $element, array &$form_state, array &$form) {
+function content_translation_language_configuration_element_process(array $element, FormStateInterface $form_state, array &$form) {
if (empty($element['#content_translation_skip_alter']) && \Drupal::currentUser()->hasPermission('administer content translation')) {
$form_state['content_translation']['key'] = $element['#name'];
$context = $form_state['language'][$element['#name']];
@@ -772,7 +773,7 @@ function content_translation_language_configuration_element_process(array $eleme
*
* @see content_translation_language_configuration_element_submit()
*/
-function content_translation_language_configuration_element_validate($element, array &$form_state, array $form) {
+function content_translation_language_configuration_element_validate($element, FormStateInterface $form_state, array $form) {
$key = $form_state['content_translation']['key'];
$values = $form_state['values'][$key];
if (!$values['language_show'] && $values['content_translation'] && \Drupal::languageManager()->isLanguageLocked($values['langcode'])) {
@@ -793,7 +794,7 @@ function content_translation_language_configuration_element_validate($element, a
*
* @see content_translation_language_configuration_element_validate()
*/
-function content_translation_language_configuration_element_submit(array $form, array &$form_state) {
+function content_translation_language_configuration_element_submit(array $form, FormStateInterface $form_state) {
$key = $form_state['content_translation']['key'];
$context = $form_state['language'][$key];
$enabled = $form_state['values'][$key]['content_translation'];
@@ -808,7 +809,7 @@ function content_translation_language_configuration_element_submit(array $form,
/**
* Implements hook_form_FORM_ID_alter() for language_content_settings_form().
*/
-function content_translation_form_language_content_settings_form_alter(array &$form, array &$form_state) {
+function content_translation_form_language_content_settings_form_alter(array &$form, FormStateInterface $form_state) {
module_load_include('inc', 'content_translation', 'content_translation.admin');
_content_translation_form_language_content_settings_form_alter($form, $form_state);
}
diff --git a/core/modules/content_translation/src/ContentTranslationHandler.php b/core/modules/content_translation/src/ContentTranslationHandler.php
index 7510d2e..d14a945 100644
--- a/core/modules/content_translation/src/ContentTranslationHandler.php
+++ b/core/modules/content_translation/src/ContentTranslationHandler.php
@@ -9,6 +9,7 @@ namespace Drupal\content_translation;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Render\Element;
@@ -75,14 +76,14 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface {
/**
* {@inheritdoc}
*/
- public function getSourceLangcode(array $form_state) {
+ public function getSourceLangcode($form_state) {
return isset($form_state['content_translation']['source']) ? $form_state['content_translation']['source']->id : FALSE;
}
/**
* {@inheritdoc}
*/
- public function entityFormAlter(array &$form, array &$form_state, EntityInterface $entity) {
+ public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity) {
$form_controller = content_translation_form_controller($form_state);
$form_langcode = $form_controller->getFormLangcode($form_state);
$entity_langcode = $entity->getUntranslated()->language()->id;
@@ -371,7 +372,7 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface {
*
* @see \Drupal\content_translation\ContentTranslationHandler::entityFormAlter()
*/
- public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, array &$form_state) {
+ public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, FormStateInterface $form_state) {
$form_controller = content_translation_form_controller($form_state);
$form_langcode = $form_controller->getFormLangcode($form_state);
@@ -410,7 +411,7 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface {
*
* Validates the submitted content translation metadata.
*/
- function entityFormValidate($form, &$form_state) {
+ function entityFormValidate($form, FormStateInterface $form_state) {
if (!empty($form_state['values']['content_translation'])) {
$translation = $form_state['values']['content_translation'];
// Validate the "authored by" field.
@@ -429,7 +430,7 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface {
*
* Takes care of the source language change.
*/
- public function entityFormSourceChange($form, &$form_state) {
+ public function entityFormSourceChange($form, FormStateInterface $form_state) {
$form_controller = content_translation_form_controller($form_state);
$entity = $form_controller->getEntity();
$source = $form_state['values']['source_langcode']['source'];
@@ -445,7 +446,7 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface {
*
* Takes care of entity deletion.
*/
- function entityFormDelete($form, &$form_state) {
+ function entityFormDelete($form, FormStateInterface $form_state) {
$form_controller = content_translation_form_controller($form_state);
$entity = $form_controller->getEntity();
if (count($entity->getTranslationLanguages()) > 1) {
@@ -458,7 +459,7 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface {
*
* Takes care of content translation deletion.
*/
- function entityFormDeleteTranslation($form, &$form_state) {
+ function entityFormDeleteTranslation($form, FormStateInterface $form_state) {
$form_controller = content_translation_form_controller($form_state);
$entity = $form_controller->getEntity();
$path = $entity->getSystemPath('drupal:content-translation-overview');
diff --git a/core/modules/content_translation/src/ContentTranslationHandlerInterface.php b/core/modules/content_translation/src/ContentTranslationHandlerInterface.php
index c41fd27..67c4d0d 100644
--- a/core/modules/content_translation/src/ContentTranslationHandlerInterface.php
+++ b/core/modules/content_translation/src/ContentTranslationHandlerInterface.php
@@ -8,6 +8,7 @@
namespace Drupal\content_translation;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Interface for providing content translation.
@@ -37,13 +38,13 @@ interface ContentTranslationHandlerInterface {
/**
* Retrieves the source language for the translation being created.
*
- * @param array $form_state
- * The form state array.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return string
* The source language code.
*/
- public function getSourceLangcode(array $form_state);
+ public function getSourceLangcode($form_state);
/**
* Marks translations as outdated.
@@ -61,11 +62,11 @@ interface ContentTranslationHandlerInterface {
*
* @param array $form
* The entity form to be altered to provide the translation workflow.
- * @param array $form_state
- * The form state array.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity being created or edited.
*/
- public function entityFormAlter(array &$form, array &$form_state, EntityInterface $entity);
+ public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity);
}
diff --git a/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php b/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php
index af2d3af..a265124 100644
--- a/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php
+++ b/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php
@@ -8,6 +8,7 @@
namespace Drupal\content_translation\Form;
use Drupal\Core\Form\ConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
@@ -39,7 +40,7 @@ class ContentTranslationDeleteForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, $_entity_type_id = NULL, $language = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, $_entity_type_id = NULL, $language = NULL) {
$this->entity = $this->getRequest()->attributes->get($_entity_type_id);
$this->language = language_load($language);
return parent::buildForm($form, $form_state);
@@ -69,7 +70,7 @@ class ContentTranslationDeleteForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
// Remove the translated values.
$this->entity->removeTranslation($this->language->id);
$this->entity->save();
diff --git a/core/modules/content_translation/src/Plugin/views/field/TranslationLink.php b/core/modules/content_translation/src/Plugin/views/field/TranslationLink.php
index 2a6ec79..9d234ab 100644
--- a/core/modules/content_translation/src/Plugin/views/field/TranslationLink.php
+++ b/core/modules/content_translation/src/Plugin/views/field/TranslationLink.php
@@ -7,6 +7,7 @@
namespace Drupal\content_translation\Plugin\views\field;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Entity\EntityInterface;
use Drupal\views\ResultRow;
@@ -32,7 +33,7 @@ class TranslationLink extends FieldPluginBase {
/**
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::buildOptionsForm().
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['text'] = array(
'#type' => 'textfield',
'#title' => t('Text to display'),
diff --git a/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php b/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php
index aff000c..dd8c990 100644
--- a/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php
+++ b/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php
@@ -9,6 +9,7 @@ namespace Drupal\contextual\Plugin\views\field;
use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\UrlHelper;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
@@ -37,7 +38,7 @@ class ContextualLinks extends FieldPluginBase {
return $options;
}
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$all_fields = $this->view->display_handler->getFieldLabels();
// Offer to include only those fields that follow this one.
$field_options = array_slice($all_fields, 0, array_search($this->options['id'], array_keys($all_fields)));
diff --git a/core/modules/datetime/datetime.module b/core/modules/datetime/datetime.module
index b5f98dd..e70bad3 100644
--- a/core/modules/datetime/datetime.module
+++ b/core/modules/datetime/datetime.module
@@ -7,6 +7,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Template\Attribute;
use Drupal\datetime\DateHelper;
@@ -119,10 +120,10 @@ function datetime_theme() {
*
* @param array $element
* The form element whose value is being validated.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
-function datetime_datetime_widget_validate(&$element, &$form_state) {
+function datetime_datetime_widget_validate(&$element, FormStateInterface $form_state) {
if (!form_get_errors($form_state)) {
$input_exists = FALSE;
$input = NestedArray::getValue($form_state['values'], $element['#parents'], $input_exists);
@@ -157,10 +158,10 @@ function datetime_datetime_widget_validate(&$element, &$form_state) {
*
* @param array $element
* The form element whose value is being validated.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
-function datetime_datelist_widget_validate(&$element, &$form_state) {
+function datetime_datelist_widget_validate(&$element, FormStateInterface $form_state) {
if (!form_get_errors($form_state)) {
$input_exists = FALSE;
$input = NestedArray::getValue($form_state['values'], $element['#parents'], $input_exists);
@@ -352,13 +353,13 @@ function template_preprocess_datetime_wrapper(&$variables) {
*
* @param array $element
* The form element whose value is being processed.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @return array
* The form element whose value has been processed.
*/
-function datetime_datetime_form_process($element, &$form_state) {
+function datetime_datetime_form_process($element, FormStateInterface $form_state) {
$format_settings = array();
// The value callback has populated the #value array.
$date = !empty($element['#value']['object']) ? $element['#value']['object'] : NULL;
@@ -527,10 +528,10 @@ function form_type_datetime_value($element, $input = FALSE) {
*
* @param array $element
* The form element whose value is being validated.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
-function datetime_datetime_validate($element, &$form_state) {
+function datetime_datetime_validate($element, FormStateInterface $form_state) {
$input_exists = FALSE;
$input = NestedArray::getValue($form_state['values'], $element['#parents'], $input_exists);
@@ -675,10 +676,10 @@ function datetime_format_example($format) {
*
* @param array $element
* The form element whose value is being processed.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
-function datetime_datelist_form_process($element, &$form_state) {
+function datetime_datelist_form_process($element, FormStateInterface $form_state) {
// Load translated date part labels from the appropriate calendar plugin.
$date_helper = new DateHelper();
@@ -788,14 +789,12 @@ function datetime_datelist_form_process($element, &$form_state) {
* @param array $element
* The element being processed.
* @param array|false $input
- *
- * @param array $form_state
- * (optional) The current state of the form. Defaults to an empty array.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*
* @return array
- *
*/
-function form_type_datelist_value($element, $input = FALSE, &$form_state = array()) {
+function form_type_datelist_value($element, $input = FALSE, FormStateInterface $form_state) {
$parts = $element['#date_part_order'];
$increment = $element['#date_increment'];
@@ -871,10 +870,10 @@ function form_type_datelist_value($element, $input = FALSE, &$form_state = array
*
* @param array $element
* The element being processed.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
-function datetime_datelist_validate($element, &$form_state) {
+function datetime_datelist_validate($element, FormStateInterface $form_state) {
$input_exists = FALSE;
$input = NestedArray::getValue($form_state['values'], $element['#parents'], $input_exists);
if ($input_exists) {
@@ -1001,7 +1000,7 @@ function datetime_range_years($string, $date = NULL) {
/**
* Implements hook_form_BASE_FORM_ID_alter() for node forms.
*/
-function datetime_form_node_form_alter(&$form, &$form_state, $form_id) {
+function datetime_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
// Alter the 'Authored on' date to use datetime.
$form['created']['#type'] = 'datetime';
$date_format = entity_load('date_format', 'html_date')->getPattern();
@@ -1013,7 +1012,7 @@ function datetime_form_node_form_alter(&$form, &$form_state, $form_id) {
/**
* Implements hook_node_prepare_form().
*/
-function datetime_node_prepare_form(NodeInterface $node, $operation, array &$form_state) {
+function datetime_node_prepare_form(NodeInterface $node, $operation, FormStateInterface $form_state) {
// Prepare the 'Authored on' date to use datetime.
$node->date = DrupalDateTime::createFromTimestamp($node->getCreatedTime());
}
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
index c282db6..5bff36f 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
@@ -12,6 +12,7 @@ use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Field\FormatterBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -162,7 +163,7 @@ class DateTimeDefaultFormatter extends FormatterBase implements ContainerFactory
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$time = new DrupalDateTime();
$format_types = $this->dateStorage->loadMultiple();
foreach ($format_types as $type => $type_info) {
diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
index 75a59ec..4ed473b 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
@@ -11,6 +11,7 @@ use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemList;
+use Drupal\Core\Form\FormStateInterface;
/**
* Represents a configurable entity datetime field.
@@ -25,7 +26,7 @@ class DateTimeFieldItemList extends FieldItemList {
/**
* {@inheritdoc}
*/
- public function defaultValuesForm(array &$form, array &$form_state) {
+ public function defaultValuesForm(array &$form, FormStateInterface $form_state) {
if (empty($this->getFieldDefinition()->default_value_function)) {
$default_value = $this->getFieldDefinition()->default_value;
@@ -48,12 +49,12 @@ class DateTimeFieldItemList extends FieldItemList {
/**
* {@inheritdoc}
*/
- public function defaultValuesFormValidate(array $element, array &$form, array &$form_state) { }
+ public function defaultValuesFormValidate(array $element, array &$form, FormStateInterface $form_state) { }
/**
* {@inheritdoc}
*/
- public function defaultValuesFormSubmit(array $element, array &$form, array &$form_state) {
+ public function defaultValuesFormSubmit(array $element, array &$form, FormStateInterface $form_state) {
if ($form_state['values']['default_value_input']['default_date']) {
return array($form_state['values']['default_value_input']);
}
diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
index 615ca1e..992af1e 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
@@ -8,6 +8,7 @@
namespace Drupal\datetime\Plugin\Field\FieldType;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\TypedData\DataDefinition;
use Drupal\Core\Field\FieldItemBase;
@@ -83,7 +84,7 @@ class DateTimeItem extends FieldItemBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array &$form, array &$form_state, $has_data) {
+ public function settingsForm(array &$form, FormStateInterface $form_state, $has_data) {
$element = array();
$element['datetime_type'] = array(
diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php
index c9c3195..6d05a06 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php
@@ -8,6 +8,7 @@ namespace Drupal\datetime\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
/**
@@ -37,7 +38,7 @@ class DateTimeDatelistWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$date_order = $this->getSetting('date_order');
$time_type = $this->getSetting('time_type');
$increment = $this->getSetting('increment');
@@ -122,7 +123,7 @@ class DateTimeDatelistWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
- function settingsForm(array $form, array &$form_state) {
+ function settingsForm(array $form, FormStateInterface $form_state) {
$element = parent::settingsForm($form, $form_state);
$element['date_order'] = array(
diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php
index 00426c0..a411eb4 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php
@@ -10,6 +10,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -60,7 +61,7 @@ class DateTimeDefaultWidget extends WidgetBase implements ContainerFactoryPlugin
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
// We are nesting some sub-elements inside the parent, so we need a wrapper.
// We also need to add another #title attribute at the top level for ease in
// identifying this item in error messages. We do not want to display this
diff --git a/core/modules/dblog/dblog.module b/core/modules/dblog/dblog.module
index b206879..c941c06 100644
--- a/core/modules/dblog/dblog.module
+++ b/core/modules/dblog/dblog.module
@@ -11,6 +11,7 @@
* @see watchdog()
*/
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
@@ -112,6 +113,6 @@ function dblog_form_system_logging_settings_alter(&$form, $form_state) {
*
* @see dblog_form_system_logging_settings_alter()
*/
-function dblog_logging_settings_submit($form, &$form_state) {
+function dblog_logging_settings_submit($form, FormStateInterface $form_state) {
\Drupal::config('dblog.settings')->set('row_limit', $form_state['values']['dblog_row_limit'])->save();
}
diff --git a/core/modules/dblog/src/Form/DblogClearLogConfirmForm.php b/core/modules/dblog/src/Form/DblogClearLogConfirmForm.php
index d20181b..d2b6a89 100644
--- a/core/modules/dblog/src/Form/DblogClearLogConfirmForm.php
+++ b/core/modules/dblog/src/Form/DblogClearLogConfirmForm.php
@@ -7,6 +7,7 @@
namespace Drupal\dblog\Form;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\Core\Database\Connection;
use Drupal\Core\Form\ConfirmFormBase;
@@ -67,7 +68,7 @@ class DblogClearLogConfirmForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$_SESSION['dblog_overview_filter'] = array();
$this->connection->delete('watchdog')->execute();
drupal_set_message($this->t('Database log cleared.'));
diff --git a/core/modules/dblog/src/Form/DblogClearLogForm.php b/core/modules/dblog/src/Form/DblogClearLogForm.php
index 133ab43..f3781d4 100644
--- a/core/modules/dblog/src/Form/DblogClearLogForm.php
+++ b/core/modules/dblog/src/Form/DblogClearLogForm.php
@@ -9,6 +9,7 @@ namespace Drupal\dblog\Form;
use Drupal\Core\Database\Connection;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -53,7 +54,7 @@ class DblogClearLogForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$form['dblog_clear'] = array(
'#type' => 'details',
'#title' => $this->t('Clear log messages'),
@@ -69,7 +70,7 @@ class DblogClearLogForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$form_state['redirect_route'] = new Url('dblog.confirm');
}
diff --git a/core/modules/dblog/src/Form/DblogFilterForm.php b/core/modules/dblog/src/Form/DblogFilterForm.php
index 2422472..aae5784 100644
--- a/core/modules/dblog/src/Form/DblogFilterForm.php
+++ b/core/modules/dblog/src/Form/DblogFilterForm.php
@@ -8,6 +8,7 @@
namespace Drupal\dblog\Form;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
/**
* Provides the database logging filter form.
@@ -24,7 +25,7 @@ class DblogFilterForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state) {
+ public function buildForm(array $form, FormStateInterface $form_state) {
$filters = dblog_filters();
$form['filters'] = array(
@@ -67,7 +68,7 @@ class DblogFilterForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
if (empty($form_state['values']['type']) && empty($form_state['values']['severity'])) {
$this->setFormError('type', $form_state, $this->t('You must select something to filter by.'));
}
@@ -76,7 +77,7 @@ class DblogFilterForm extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$filters = dblog_filters();
foreach ($filters as $name => $filter) {
if (isset($form_state['values'][$name])) {
@@ -88,7 +89,7 @@ class DblogFilterForm extends FormBase {
/**
* Resets the filter form.
*/
- public function resetForm(array &$form, array &$form_state) {
+ public function resetForm(array &$form, FormStateInterface $form_state) {
$_SESSION['dblog_overview_filter'] = array();
}
diff --git a/core/modules/dblog/src/Plugin/views/field/DblogMessage.php b/core/modules/dblog/src/Plugin/views/field/DblogMessage.php
index e6595d2..6c94184 100644
--- a/core/modules/dblog/src/Plugin/views/field/DblogMessage.php
+++ b/core/modules/dblog/src/Plugin/views/field/DblogMessage.php
@@ -8,6 +8,7 @@
namespace Drupal\dblog\Plugin\views\field;
use Drupal\Component\Utility\String;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
use Drupal\views\ViewExecutable;
@@ -46,7 +47,7 @@ class DblogMessage extends FieldPluginBase {
/**
* {@inheritdoc}
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['replace_variables'] = array(
diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module
index 40c1eb7..4ee1ddd 100644
--- a/core/modules/editor/editor.module
+++ b/core/modules/editor/editor.module
@@ -7,6 +7,7 @@
use Drupal\Component\Utility\Html;
use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\editor\Entity\Editor;
@@ -91,7 +92,7 @@ function editor_form_filter_admin_overview_alter(&$form, $form_state) {
/**
* Implements hook_form_BASE_FORM_ID_alter() for 'filter_format_form'.
*/
-function editor_form_filter_format_form_alter(&$form, &$form_state) {
+function editor_form_filter_format_form_alter(&$form, FormStateInterface $form_state) {
if (!isset($form_state['editor'])) {
$format_id = $form_state['controller']->getEntity()->id();
$form_state['editor'] = editor_load($format_id);
@@ -168,7 +169,7 @@ function editor_form_filter_format_form_alter(&$form, &$form_state) {
/**
* Button submit handler for filter_format_form()'s 'editor_configure' button.
*/
-function editor_form_filter_admin_format_editor_configure($form, &$form_state) {
+function editor_form_filter_admin_format_editor_configure($form, FormStateInterface $form_state) {
$editor = $form_state['editor'];
if (isset($form_state['values']['editor']['editor'])) {
if ($form_state['values']['editor']['editor'] === '') {
@@ -188,14 +189,14 @@ function editor_form_filter_admin_format_editor_configure($form, &$form_state) {
/**
* AJAX callback handler for filter_format_form().
*/
-function editor_form_filter_admin_form_ajax($form, &$form_state) {
+function editor_form_filter_admin_form_ajax($form, FormStateInterface $form_state) {
return $form['editor']['settings'];
}
/**
* Additional validate handler for filter_format_form().
*/
-function editor_form_filter_admin_format_validate($form, &$form_state) {
+function editor_form_filter_admin_format_validate($form, FormStateInterface $form_state) {
// This validate handler is not applicable when using the 'Configure' button.
if ($form_state['triggering_element']['#name'] === 'editor_configure') {
return;
@@ -213,7 +214,7 @@ function editor_form_filter_admin_format_validate($form, &$form_state) {
/**
* Additional submit handler for filter_format_form().
*/
-function editor_form_filter_admin_format_submit($form, &$form_state) {
+function editor_form_filter_admin_format_submit($form, FormStateInterface $form_state) {
// Delete the existing editor if disabling or switching between editors.
$format_id = $form_state['controller']->getEntity()->id();
$original_editor = editor_load($format_id);
diff --git a/core/modules/editor/src/Form/EditorImageDialog.php b/core/modules/editor/src/Form/EditorImageDialog.php
index 82524b6..f8c45e9 100644
--- a/core/modules/editor/src/Form/EditorImageDialog.php
+++ b/core/modules/editor/src/Form/EditorImageDialog.php
@@ -10,6 +10,7 @@ namespace Drupal\editor\Form;
use Drupal\Component\Utility\Bytes;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\filter\Entity\FilterFormat;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;
@@ -34,7 +35,7 @@ class EditorImageDialog extends FormBase {
* @param \Drupal\filter\Entity\FilterFormat $filter_format
* The filter format for which this dialog corresponds.
*/
- public function buildForm(array $form, array &$form_state, FilterFormat $filter_format = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, FilterFormat $filter_format = NULL) {
// The default values are set directly from \Drupal::request()->request,
// provided by the editor plugin opening the dialog.
if (!isset($form_state['image_element'])) {
@@ -184,7 +185,7 @@ class EditorImageDialog extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$response = new AjaxResponse();
// Convert any uploaded files from the FID values to data-editor-file-uuid
diff --git a/core/modules/editor/src/Form/EditorLinkDialog.php b/core/modules/editor/src/Form/EditorLinkDialog.php
index b0beb5b..8f31c3c 100644
--- a/core/modules/editor/src/Form/EditorLinkDialog.php
+++ b/core/modules/editor/src/Form/EditorLinkDialog.php
@@ -8,6 +8,7 @@
namespace Drupal\editor\Form;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\filter\Entity\FilterFormat;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;
@@ -32,7 +33,7 @@ class EditorLinkDialog extends FormBase {
* @param \Drupal\filter\Entity\FilterFormat $filter_format
* The filter format for which this dialog corresponds.
*/
- public function buildForm(array $form, array &$form_state, FilterFormat $filter_format = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, FilterFormat $filter_format = NULL) {
// The default values are set directly from \Drupal::request()->request,
// provided by the editor plugin opening the dialog.
$input = isset($form_state['input']['editor_object']) ? $form_state['input']['editor_object'] : array();
@@ -78,7 +79,7 @@ class EditorLinkDialog extends FormBase {
/**
* {@inheritdoc}
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
$response = new AjaxResponse();
if (form_get_errors($form_state)) {
diff --git a/core/modules/editor/src/Plugin/EditorBase.php b/core/modules/editor/src/Plugin/EditorBase.php
index 32e4408..4cb1fe2 100644
--- a/core/modules/editor/src/Plugin/EditorBase.php
+++ b/core/modules/editor/src/Plugin/EditorBase.php
@@ -7,6 +7,7 @@
namespace Drupal\editor\Plugin;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginBase;
use Drupal\editor\Entity\Editor;
use Drupal\editor\Plugin\EditorPluginInterface;
@@ -54,20 +55,20 @@ abstract class EditorBase extends PluginBase implements EditorPluginInterface {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state, Editor $editor) {
+ public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
return $form;
}
/**
* {@inheritdoc}
*/
- public function settingsFormValidate(array $form, array &$form_state) {
+ public function settingsFormValidate(array $form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
- public function settingsFormSubmit(array $form, array &$form_state) {
+ public function settingsFormSubmit(array $form, FormStateInterface $form_state) {
}
}
diff --git a/core/modules/editor/src/Plugin/EditorPluginInterface.php b/core/modules/editor/src/Plugin/EditorPluginInterface.php
index c6b6c54..10ad314 100644
--- a/core/modules/editor/src/Plugin/EditorPluginInterface.php
+++ b/core/modules/editor/src/Plugin/EditorPluginInterface.php
@@ -8,6 +8,7 @@
namespace Drupal\editor\Plugin;
use Drupal\Component\Plugin\PluginInspectionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\editor\Entity\Editor;
/**
@@ -37,7 +38,7 @@ interface EditorPluginInterface extends PluginInspectionInterface {
*
* @param array $form
* An empty form array to be populated with a configuration form, if any.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The state of the entire filter administration form.
* @param \Drupal\editor\Entity\Editor $editor
* A configured text editor object.
@@ -45,7 +46,7 @@ interface EditorPluginInterface extends PluginInspectionInterface {
* @return array
* A render array for the settings form.
*/
- public function settingsForm(array $form, array &$form_state, Editor $editor);
+ public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor);
/**
* Validates the settings form for an editor.
@@ -56,10 +57,10 @@ interface EditorPluginInterface extends PluginInspectionInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * A reference to a keyed array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function settingsFormValidate(array $form, array &$form_state);
+ public function settingsFormValidate(array $form, FormStateInterface $form_state);
/**
* Modifies any values in the form state to prepare them for saving.
@@ -69,10 +70,10 @@ interface EditorPluginInterface extends PluginInspectionInterface {
*
* @param array $form
* An associative array containing the structure of the form.
- * @param array $form_state
- * A reference to a keyed array containing the current state of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
*/
- public function settingsFormSubmit(array $form, array &$form_state);
+ public function settingsFormSubmit(array $form, FormStateInterface $form_state);
/**
* Returns JavaScript settings to be attached.
diff --git a/core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php b/core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php
index 5015759..6937fb2 100644
--- a/core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php
+++ b/core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php
@@ -7,6 +7,7 @@
namespace Drupal\editor_test\Plugin\Editor;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\editor\Plugin\EditorBase;
use Drupal\editor\Entity\Editor as EditorEntity;
@@ -33,7 +34,7 @@ class UnicornEditor extends EditorBase {
/**
* {@inheritdoc}
*/
- function settingsForm(array $form, array &$form_state, EditorEntity $editor) {
+ function settingsForm(array $form, FormStateInterface $form_state, EditorEntity $editor) {
$form['foo'] = array(
'#title' => t('Foo'),
'#type' => 'textfield',
diff --git a/core/modules/entity/src/Entity/EntityFormDisplay.php b/core/modules/entity/src/Entity/EntityFormDisplay.php
index 8365032..6457e23 100644
--- a/core/modules/entity/src/Entity/EntityFormDisplay.php
+++ b/core/modules/entity/src/Entity/EntityFormDisplay.php
@@ -9,6 +9,7 @@ namespace Drupal\entity\Entity;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\entity\EntityDisplayBase;
/**
@@ -148,7 +149,7 @@ class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayIn
/**
* {@inheritdoc}
*/
- public function buildForm(ContentEntityInterface $entity, array &$form, array &$form_state) {
+ public function buildForm(ContentEntityInterface $entity, array &$form, FormStateInterface $form_state) {
// Set #parents to 'top-level' by default.
$form += array('#parents' => array());
@@ -197,7 +198,7 @@ class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayIn
/**
* {@inheritdoc}
*/
- public function extractFormValues(ContentEntityInterface $entity, array &$form, array &$form_state) {
+ public function extractFormValues(ContentEntityInterface $entity, array &$form, FormStateInterface $form_state) {
$extracted = array();
foreach ($entity as $name => $items) {
if ($widget = $this->getRenderer($name)) {
@@ -211,7 +212,7 @@ class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayIn
/**
* {@inheritdoc}
*/
- public function validateFormValues(ContentEntityInterface $entity, array &$form, array &$form_state) {
+ public function validateFormValues(ContentEntityInterface $entity, array &$form, FormStateInterface $form_state) {
foreach ($entity as $field_name => $items) {
// Only validate the fields that actually appear in the form, and let the
// widget assign the violations to the right form elements.
diff --git a/core/modules/entity/src/Form/EntityDisplayModeAddForm.php b/core/modules/entity/src/Form/EntityDisplayModeAddForm.php
index 49be44f..296fde2 100644
--- a/core/modules/entity/src/Form/EntityDisplayModeAddForm.php
+++ b/core/modules/entity/src/Form/EntityDisplayModeAddForm.php
@@ -7,6 +7,7 @@
namespace Drupal\entity\Form;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -24,7 +25,7 @@ class EntityDisplayModeAddForm extends EntityDisplayModeFormBase {
/**
* {@inheritdoc}
*/
- public function buildForm(array $form, array &$form_state, $entity_type_id = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, $entity_type_id = NULL) {
$this->targetEntityTypeId = $entity_type_id;
$form = parent::buildForm($form, $form_state);
// Change replace_pattern to avoid undesired dots.
@@ -37,7 +38,7 @@ class EntityDisplayModeAddForm extends EntityDisplayModeFormBase {
/**
* {@inheritdoc}
*/
- public function validate(array $form, array &$form_state) {
+ public function validate(array $form, FormStateInterface $form_state) {
parent::validate($form, $form_state);
form_set_value($form['id'], $this->targetEntityTypeId . '.' . $form_state['values']['id'], $form_state);
diff --git a/core/modules/entity/src/Form/EntityDisplayModeDeleteForm.php b/core/modules/entity/src/Form/EntityDisplayModeDeleteForm.php
index 091d5fe..b76d56b 100644
--- a/core/modules/entity/src/Form/EntityDisplayModeDeleteForm.php
+++ b/core/modules/entity/src/Form/EntityDisplayModeDeleteForm.php
@@ -8,6 +8,7 @@
namespace Drupal\entity\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
@@ -48,7 +49,7 @@ class EntityDisplayModeDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
- public function submit(array $form, array &$form_state) {
+ public function submit(array $form, FormStateInterface $form_state) {
parent::submit($form, $form_state);
$entity_type = $this->entity->getEntityType();
diff --git a/core/modules/entity/src/Form/EntityDisplayModeFormBase.php b/core/modules/entity/src/Form/EntityDisplayModeFormBase.php
index e848413..52e3388 100644
--- a/core/modules/entity/src/Form/EntityDisplayModeFormBase.php
+++ b/core/modules/entity/src/Form/EntityDisplayModeFormBase.php
@@ -10,6 +10,7 @@ namespace Drupal\entity\Form;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -64,7 +65,7 @@ abstract class EntityDisplayModeFormBase extends EntityForm {
/**
* {@inheritdoc}
*/
- protected function init(array &$form_state) {
+ protected function init(FormStateInterface $form_state) {
parent::init($form_state);
$this->entityType = $this->entityManager->getDefinition($this->entity->getEntityTypeId());
}
@@ -72,7 +73,7 @@ abstract class EntityDisplayModeFormBase extends EntityForm {
/**
* {@inheritdoc}
*/
- public function form(array $form, array &$form_state) {
+ public function form(array $form, FormStateInterface $form_state) {
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Label'),
@@ -102,13 +103,11 @@ abstract class EntityDisplayModeFormBase extends EntityForm {
* The entity ID.
* @param array $element
* The form element.
- * @param array $form_state
- * The form state.
*
* @return bool
* TRUE if the display mode exists, FALSE otherwise.
*/
- public function exists($entity_id, array $element, array $form_state) {
+ public function exists($entity_id, array $element) {
// Do not allow to add internal 'default' view mode.
if ($entity_id == 'default') {
return TRUE;
@@ -122,7 +121,7 @@ abstract class EntityDisplayModeFormBase extends EntityForm {
/**
* {@inheritdoc}
*/
- public function save(array $form, array &$form_state) {
+ public function save(array $form, FormStateInterface $form_state) {
drupal_set_message(t('Saved the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => $this->entityType->getLowercaseLabel())));
$this->entity->save();
\Drupal::entityManager()->clearCachedFieldDefinitions();
diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module
index 7fcc560..d1babc8 100644
--- a/core/modules/entity_reference/entity_reference.module
+++ b/core/modules/entity_reference/entity_reference.module
@@ -7,6 +7,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Database\Query\AlterableInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\field\Entity\FieldStorageConfig;
@@ -147,7 +148,7 @@ function _entity_reference_form_process_merge_parent($element) {
/**
* Form element validation handler; Filters the #value property of an element.
*/
-function _entity_reference_element_validate_filter(&$element, &$form_state) {
+function _entity_reference_element_validate_filter(&$element, FormStateInterface $form_state) {
$element['#value'] = array_filter($element['#value']);
form_set_value($element, $element['#value'], $form_state);
}
@@ -167,7 +168,7 @@ function entity_reference_settings_ajax($form, $form_state) {
*
* @see entity_reference_field_instance_settings_form()
*/
-function entity_reference_settings_ajax_submit($form, &$form_state) {
+function entity_reference_settings_ajax_submit($form, FormStateInterface $form_state) {
$form_state['rebuild'] = TRUE;
}
diff --git a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
index 269ad8c..032a365 100644
--- a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
+++ b/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
@@ -10,6 +10,7 @@ namespace Drupal\entity_reference;
use Drupal\Component\Utility\String;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\OptGroup;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\TypedData\AllowedValuesInterface;
@@ -159,7 +160,7 @@ class ConfigurableEntityReferenceItem extends EntityReferenceItem implements All
/**
* {@inheritdoc}
*/
- public function settingsForm(array &$form, array &$form_state, $has_data) {
+ public function settingsForm(array &$form, FormStateInterface $form_state, $has_data) {
$element['target_type'] = array(
'#type' => 'select',
'#title' => t('Type of item to reference'),
@@ -176,7 +177,7 @@ class ConfigurableEntityReferenceItem extends EntityReferenceItem implements All
/**
* {@inheritdoc}
*/
- public function instanceSettingsForm(array $form, array &$form_state) {
+ public function instanceSettingsForm(array $form, FormStateInterface $form_state) {
$instance = $form_state['instance'];
// Get all selection plugins for this entity type.
@@ -247,10 +248,10 @@ class ConfigurableEntityReferenceItem extends EntityReferenceItem implements All
*
* @param array $form
* The form where the settings form is being included in.
- * @param array $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state of the (entire) configuration form.
*/
- public static function instanceSettingsFormValidate(array $form, array &$form_state) {
+ public static function instanceSettingsFormValidate(array $form, FormStateInterface $form_state) {
if (isset($form_state['values']['instance'])) {
unset($form_state['values']['instance']['settings']['handler_submit']);
$form_state['instance']->settings = $form_state['values']['instance']['settings'];
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
index 15f1df1..448343e 100644
--- a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
@@ -8,6 +8,7 @@
namespace Drupal\entity_reference\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\entity_reference\RecursiveRenderingException;
/**
@@ -37,7 +38,7 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$elements['view_mode'] = array(
'#type' => 'select',
'#options' => \Drupal::entityManager()->getViewModeOptions($this->getFieldSetting('target_type')),
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
index 54a1ae7..154759f 100644
--- a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
@@ -9,6 +9,7 @@ namespace Drupal\entity_reference\Plugin\Field\FieldFormatter;
use Drupal\Component\Utility\String;
use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'entity reference label' formatter.
@@ -36,7 +37,7 @@ class EntityReferenceLabelFormatter extends EntityReferenceFormatterBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$elements['link'] = array(
'#title' => t('Link label to the referenced entity'),
'#type' => 'checkbox',
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldType/ConfigurableEntityReferenceFieldItemList.php b/core/modules/entity_reference/src/Plugin/Field/FieldType/ConfigurableEntityReferenceFieldItemList.php
index 3d4bec3..25d8546 100644
--- a/core/modules/entity_reference/src/Plugin/Field/FieldType/ConfigurableEntityReferenceFieldItemList.php
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldType/ConfigurableEntityReferenceFieldItemList.php
@@ -10,6 +10,7 @@ namespace Drupal\entity_reference\Plugin\Field\FieldType;
use Drupal\Core\Field\EntityReferenceFieldItemList;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Represents a configurable entity_reference entity field.
@@ -73,7 +74,7 @@ class ConfigurableEntityReferenceFieldItemList extends EntityReferenceFieldItemL
/**
* {@inheritdoc}
*/
- public function defaultValuesFormSubmit(array $element, array &$form, array &$form_state) {
+ public function defaultValuesFormSubmit(array $element, array &$form, FormStateInterface $form_state) {
$default_value = parent::defaultValuesFormSubmit($element, $form, $form_state);
// Convert numeric IDs to UUIDs to ensure config deployability.
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteTagsWidget.php b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteTagsWidget.php
index f930de2..b289a06 100644
--- a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteTagsWidget.php
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteTagsWidget.php
@@ -8,6 +8,7 @@
namespace Drupal\entity_reference\Plugin\Field\FieldWidget;
use Drupal\Component\Utility\Tags;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'entity_reference autocomplete-tags' widget.
@@ -39,7 +40,7 @@ class AutocompleteTagsWidget extends AutocompleteWidgetBase {
/**
* {@inheritdoc}
*/
- public function elementValidate($element, &$form_state, $form) {
+ public function elementValidate($element, FormStateInterface $form_state, $form) {
$value = array();
// If a value was entered into the autocomplete.
$handler = \Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($this->fieldDefinition);
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidget.php b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidget.php
index 234eb7a..3633b5d 100644
--- a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidget.php
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidget.php
@@ -8,6 +8,7 @@
namespace Drupal\entity_reference\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'entity_reference autocomplete' widget.
@@ -57,7 +58,7 @@ class AutocompleteWidget extends AutocompleteWidgetBase {
/**
* {@inheritdoc}
*/
- public function elementValidate($element, &$form_state, $form) {
+ public function elementValidate($element, FormStateInterface $form_state, $form) {
$auto_create = $this->getSelectionHandlerSetting('auto_create');
// If a value was entered into the autocomplete.
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php
index 2ed1dfe..975ec4f 100644
--- a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php
@@ -10,6 +10,7 @@ namespace Drupal\entity_reference\Plugin\Field\FieldWidget;
use Drupal\Component\Utility\Tags;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\user\EntityOwnerInterface;
use Symfony\Component\Validator\ConstraintViolationInterface;
@@ -21,7 +22,7 @@ abstract class AutocompleteWidgetBase extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['match_operator'] = array(
'#type' => 'radios',
'#title' => t('Autocomplete matching'),
@@ -70,7 +71,7 @@ abstract class AutocompleteWidgetBase extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
+ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$entity = $items->getEntity();
// Prepare the autocomplete route parameters.
@@ -103,14 +104,14 @@ abstract class AutocompleteWidgetBase extends WidgetBase {
/**
* {@inheritdoc}
*/
- public function errorElement(array $element, ConstraintViolationInterface $error, array $form, array &$form_state) {
+ public function errorElement(array $element, ConstraintViolationInterface $error, array $form, FormStateInterface $form_state) {
return $element['target_id'];
}
/**
* Validates an element.
*/
- public function elementValidate($element, &$form_state, $form) { }
+ public function elementValidate($element, FormStateInterface $form_state, $form) { }
/**
* Gets the entity labels.
diff --git a/core/modules/entity_reference/src/Plugin/Type/Selection/SelectionBroken.php b/core/modules/entity_reference/src/Plugin/Type/Selection/SelectionBroken.php
index eab272e..37a5264 100644
--- a/core/modules/entity_reference/src/Plugin/Type/Selection/SelectionBroken.php
+++ b/core/modules/entity_reference/src/Plugin/Type/Selection/SelectionBroken.php
@@ -9,6 +9,7 @@ namespace Drupal\entity_reference\Plugin\Type\Selection;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* A null implementation of SelectionInterface.
@@ -49,7 +50,7 @@ class SelectionBroken implements SelectionInterface {
/**
* {@inheritdoc}
*/
- public function validateAutocompleteInput($input, &$element, &$form_state, $form, $strict = TRUE) { }
+ public function validateAutocompleteInput($input, &$element, FormStateInterface $form_state, $form, $strict = TRUE) { }
/**
* {@inheritdoc}
diff --git a/core/modules/entity_reference/src/Plugin/Type/Selection/SelectionInterface.php b/core/modules/entity_reference/src/Plugin/Type/Selection/SelectionInterface.php
index 28fc2c5..eb3b8ae 100644
--- a/core/modules/entity_reference/src/Plugin/Type/Selection/SelectionInterface.php
+++ b/core/modules/entity_reference/src/Plugin/Type/Selection/SelectionInterface.php
@@ -9,6 +9,7 @@ namespace Drupal\entity_reference\Plugin\Type\Selection;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Interface definition for Entity Reference Selection plugins.
@@ -54,6 +55,10 @@ interface SelectionInterface {
* Single string from autocomplete widget.
* @param array $element
* The form element to set a form error.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current form state.
+ * @param array $form
+ * The form.
* @param boolean $strict
* Whether to trigger a form error if an element from $input (eg. an entity)
* is not found. Defaults to TRUE.
@@ -63,7 +68,7 @@ interface SelectionInterface {
*
* @see \Drupal\entity_reference\Plugin\Field\FieldWidget::elementValidate()
*/
- public function validateAutocompleteInput($input, &$element, &$form_state, $form, $strict = TRUE);
+ public function validateAutocompleteInput($input, &$element, FormStateInterface $form_state, $form, $strict = TRUE);
/**
* Allows the selection to alter the SelectQuery generated by EntityFieldQuery.
diff --git a/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php
index 11ee6cd..fbb6537 100644
--- a/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php
+++ b/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php
@@ -12,6 +12,7 @@ use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface;
/**
@@ -229,7 +230,7 @@ class SelectionBase implements SelectionInterface {
/**
* {@inheritdoc}
*/
- public function validateAutocompleteInput($input, &$element, &$form_state, $form, $strict = TRUE) {
+ public function validateAutocompleteInput($input, &$element, FormStateInterface $form_state, $form, $strict = TRUE) {
$bundled_entities = $this->getReferenceableEntities($input, '=', 6);
$entities = array();
foreach ($bundled_entities as $entities_list) {
diff --git a/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php b/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php
index b975b0a..8434e97 100644
--- a/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php
+++ b/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php
@@ -7,6 +7,7 @@
namespace Drupal\entity_reference\Plugin\views\row;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\row\Fields;
/**
@@ -38,7 +39,7 @@ class EntityReference extends Fields {
/**
* Overrides \Drupal\views\Plugin\views\row\Fields::buildOptionsForm().
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
// Expand the description of the 'Inline field' checkboxes.
diff --git a/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php b/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php
index 37a446b..d0b3bbe 100644
--- a/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php
+++ b/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php
@@ -8,6 +8,7 @@
namespace Drupal\entity_reference\Plugin\views\style;
use Drupal\Component\Utility\Xss;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\style\StylePluginBase;
/**
@@ -54,7 +55,7 @@ class EntityReference extends StylePluginBase {
/**
* Overrides \Drupal\views\Plugin\views\style\StylePluginBase\StylePluginBase::buildOptionsForm().
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$options = $this->displayHandler->getFieldLabels(TRUE);
diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php
index 62a8c1c..543561e7 100644
--- a/core/modules/field/field.api.php
+++ b/core/modules/field/field.api.php
@@ -105,7 +105,7 @@ function hook_field_widget_info_alter(array &$info) {
* @param $element
* The field widget form element as constructed by hook_field_widget_form().
* @param $form_state
- * An associative array containing the current state of the form.
+ * The current state of the form.
* @param $context
* An associative array containing the following key-value pairs:
* - form: The form structure to which widgets are being attached. This may be
@@ -120,7 +120,7 @@ function hook_field_widget_info_alter(array &$info) {
* @see \Drupal\Core\Field\WidgetBase::formSingleElement()
* @see hook_field_widget_WIDGET_TYPE_form_alter()
*/
-function hook_field_widget_form_alter(&$element, &$form_state, $context) {
+function hook_field_widget_form_alter(&$element, \Drupal\Core\Form\FormStateInterface $form_state, $context) {
// Add a css class to widget form elements for all fields of type mytype.
$field_definition = $context['items']->getFieldDefinition();
if ($field_definition->getType() == 'mytype') {
@@ -139,7 +139,7 @@ function hook_field_widget_form_alter(&$element, &$form_state, $context) {
* @param $element
* The field widget form element as constructed by hook_field_widget_form().
* @param $form_state
- * An associative array containing the current state of the form.
+ * The current state of the form.
* @param $context
* An associative array. See hook_field_widget_form_alter() for the structure
* and content of the array.
@@ -147,7 +147,7 @@ function hook_field_widget_form_alter(&$element, &$form_state, $context) {
* @see \Drupal\Core\Field\WidgetBase::formSingleElement()
* @see hook_field_widget_form_alter()
*/
-function hook_field_widget_WIDGET_TYPE_form_alter(&$element, &$form_state, $context) {
+function hook_field_widget_WIDGET_TYPE_form_alter(&$element, \Drupal\Core\Form\FormStateInterface $form_state, $context) {
// Code here will only act on widgets of type WIDGET_TYPE. For example,
// hook_field_widget_mymodule_autocomplete_form_alter() will only act on
// widgets of type 'mymodule_autocomplete'.
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 444a92d..8bcb693 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -10,6 +10,7 @@ use Drupal\Component\Utility\Xss;
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Extension\Extension;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/*
@@ -344,7 +345,7 @@ function field_config_import_steps_alter(&$sync_steps, ConfigImporter $config_im
*
* @see \Drupal\field\ConfigImporterFieldPurger
*/
-function field_form_config_admin_import_form_alter(&$form, &$form_state) {
+function field_form_config_admin_import_form_alter(&$form, FormStateInterface $form_state) {
// Only display the message when there is a storage comparer available and the
// form is not submitted.
if (isset($form_state['storage_comparer']) && empty($form_state['input'])) {
diff --git a/core/modules/field/src/Plugin/views/argument/FieldList.php b/core/modules/field/src/Plugin/views/argument/FieldList.php
index 5bfd935..08c7756 100644
--- a/core/modules/field/src/Plugin/views/argument/FieldList.php
+++ b/core/modules/field/src/Plugin/views/argument/FieldList.php
@@ -8,6 +8,7 @@
namespace Drupal\field\Plugin\views\argument;
use Drupal\Component\Utility\String;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\argument\Numeric;
@@ -47,7 +48,7 @@ class FieldList extends Numeric {
return $options;
}
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['summary']['human'] = array(
diff --git a/core/modules/field/src/Plugin/views/argument/ListString.php b/core/modules/field/src/Plugin/views/argument/ListString.php
index 02d049a..eee75e2 100644
--- a/core/modules/field/src/Plugin/views/argument/ListString.php
+++ b/core/modules/field/src/Plugin/views/argument/ListString.php
@@ -8,6 +8,7 @@
namespace Drupal\field\Plugin\views\argument;
use Drupal\Component\Utility\String as UtilityString;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\argument\String;
@@ -48,7 +49,7 @@ class ListString extends String {
return $options;
}
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['summary']['human'] = array(
diff --git a/core/modules/field/src/Plugin/views/field/Field.php b/core/modules/field/src/Plugin/views/field/Field.php
index ad3543b..e4103f3 100644
--- a/core/modules/field/src/Plugin/views/field/Field.php
+++ b/core/modules/field/src/Plugin/views/field/Field.php
@@ -16,6 +16,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Field\FormatterPluginManager;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Render\Element;
@@ -435,7 +436,7 @@ class Field extends FieldPluginBase {
/**
* {@inheritdoc}
*/
- public function buildOptionsForm(&$form, &$form_state) {
+ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$field = $this->getFieldDefinition();
@@ -516,7 +517,7 @@ class Field extends FieldPluginBase {
/**
* Provide options for multiple value fields.
*/
- function multiple_options_form(&$form, &$form_state) {
+ function multiple_options_form(&$form, FormStateInterface $form_state) {
$field = $this->getFieldDefinition();
$form['multiple_field_settings'] = array(
@@ -639,7 +640,7 @@ class Field extends FieldPluginBase {
/**
* Extend the groupby form with group columns.
*/
- public function buildGroupByForm(&$form, &$form_state) {
+ public function buildGroupByForm(&$form, FormStateInterface $form_state) {
parent::buildGroupByForm($form, $form_state);
// With "field API" fields, the column target of the grouping function
// and any additional grouping columns must be specified.
@@ -672,7 +673,7 @@ class Field extends FieldPluginBase {
);
}
- public function submitGroupByForm(&$form, &$form_state) {
+ public function submitGroupByForm(&$form, FormStateInterface $form_state) {
parent::submitGroupByForm($form, $form_state);
$item = &$form_state['handler']->options;
diff --git a/core/modules/field/src/Tests/FieldAttachOtherTest.php b/core/modules/field/src/Tests/FieldAttachOtherTest.php
index 7356bce..a74e4d2 100644
--- a/core/modules/field/src/Tests/FieldAttachOtherTest.php
+++ b/core/modules/field/src/Tests/FieldAttachOtherTest.php
@@ -7,6 +7,7 @@
namespace Drupal\field\Tests;
+use Drupal\Core\Form\FormState;
use Drupal\Core\Language\LanguageInterface;
/**
@@ -265,7 +266,7 @@ class FieldAttachOtherTest extends FieldUnitTestBase {
// Test generating widgets for all fields.
$display = entity_get_form_display($entity_type, $this->instance->bundle, 'default');
$form = array();
- $form_state = \Drupal::formBuilder()->getFormStateDefaults();
+ $form_state = new FormState();
$display->buildForm($entity, $form, $form_state);
$this->assertEqual($form[$this->field_name]['widget']['#title'], $this->instance->getLabel(), "First field's form title is {$this->instance->getLabel()}");
@@ -287,7 +288,7 @@ class FieldAttachOtherTest extends FieldUnitTestBase {
}
}
$form = array();
- $form_state = \Drupal::formBuilder()->getFormStateDefaults();
+ $form_state = new FormState();
$display->buildForm($entity, $form, $form_state);
$this->assertFalse(isset($form[$this->field_name]), 'The first field does not exist in the form');
@@ -310,7 +311,7 @@ class FieldAttachOtherTest extends FieldUnitTestBase {
// Build the form for all fields.
$display = entity_get_form_display($entity_type, $this->instance->bundle, 'default');
$form = array();
- $form_state = \Drupal::formBuilder()->getFormStateDefaults();
+ $form_state = new FormState();
$display->buildForm($entity_init, $form, $form_state);
// Simulate incoming values.
diff --git a/core/modules/field/src/Tests/FormTest.php b/core/modules/field/src/Tests/FormTest.php
index 2457aa7..262a96d 100644
--- a/core/modules/field/src/Tests/FormTest.php
+++ b/core/modules/field/src/Tests/FormTest.php
@@ -9,6 +9,7 @@ namespace Drupal\field\Tests;
use Drupal\Component\Utility\String;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Form\FormState;
/**
* Tests field form handling.
@@ -531,7 +532,7 @@ class FormTest extends FieldTestBase {
$display = entity_get_form_display($entity_type, $entity_type, 'default');
$form = array();
- $form_state = \Drupal::formBuilder()->getFormStateDefaults();
+ $form_state = new FormState();
$display->buildForm($entity, $form, $form_state);
$this->assertFalse($form[$field_name_no_access]['#access'], 'Field #access is FALSE for the field without edit access.');
diff --git a/core/modules/field/tests/modules/field_test/field_test.module b/core/modules/field/tests/modules/field_test/field_test.module
index 13c846d..499c883 100644
--- a/core/modules/field/tests/modules/field_test/field_test.module
+++ b/core/modules/field/tests/modules/field_test/field_test.module
@@ -2,6 +2,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\field\FieldStorageConfigInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* @file
@@ -115,7 +116,7 @@ function field_test_entity_display_build_alter(&$output, $context) {
/**
* Implements hook_field_widget_form_alter().
*/
-function field_test_field_widget_form_alter(&$element, &$form_state, $context) {
+function field_test_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) {
$field_definition = $context['items']->getFieldDefinition();
switch ($field_definition->getName()) {
case 'alter_test_text':
diff --git a/core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php b/core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php
index 89aa42c..ea5a30e 100644
--- a/core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php
+++ b/core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php
@@ -9,6 +9,7 @@ namespace Drupal\field_test\Form;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\entity\Entity\EntityFormDisplay;
/**
@@ -26,7 +27,7 @@ class NestedEntityTestForm extends FormBase {
/**
* {@inheritdoc]
*/
- public function buildForm(array $form, array &$form_state, EntityInterface $entity_1 = NULL, EntityInterface $entity_2 = NULL) {
+ public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity_1 = NULL, EntityInterface $entity_2 = NULL) {
// First entity.
$form_state['entity_1'] = $entity_1;
$form_state['form_display_1'] = EntityFormDisplay::collectRenderDisplay($entity_1, 'default');
@@ -57,7 +58,7 @@ class NestedEntityTestForm extends FormBase {
/**
* {@inheritdoc]
*/
- public function validateForm(array &$form, array &$form_state) {
+ public function validateForm(array &$form, FormStateInterface $form_state) {
$entity_1 = $form_state['entity_1'];
/** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display_1 */
$form_display_1 = $form_state['form_display_1'];
@@ -74,7 +75,7 @@ class NestedEntityTestForm extends FormBase {
/**
* {@inheritdoc]
*/
- public function submitForm(array &$form, array &$form_state) {
+ public function submitForm(array &$form, FormStateInterface $form_state) {
/** @var \Drupal\Core\Entity\EntityInterface $entity_1 */
$entity_1 = $form_state['entity_1'];
$entity_1->save();
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php
index 3e61ca1..d195a31 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php
@@ -9,6 +9,7 @@ namespace Drupal\field_test\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'field_test_default' formatter.
@@ -37,7 +38,7 @@ class TestFieldDefaultFormatter extends FormatterBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['test_formatter_setting'] = array(
'#title' => t('Setting'),
'#type' => 'textfield',
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php
index 7cd25fb..84938ec 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php
@@ -9,6 +9,7 @@ namespace Drupal\field_test\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'field_empty_setting' formatter.
@@ -36,7 +37,7 @@ class TestFieldEmptySettingFormatter extends FormatterBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['field_empty_setting'] = array(
'#title' => t('Setting'),
'#type' => 'textfield',
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php
index 1aeb570..a310ad3 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php
@@ -9,6 +9,7 @@ namespace Drupal\field_test\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the 'field_test_multiple' formatter.
@@ -37,7 +38,7 @@ class TestFieldMultipleFormatter extends FormatterBase {
/**
* {@inheritdoc}
*/
- public function settingsForm(array $form, array &$form_state) {
+ public function settingsForm(array $form, FormStateInterface $form_state) {
$element['test_formatter_setting_multiple'] = array(
'#title' => t('Setting'),
'#type' => 'textfield',
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFo