Classes, traits, and interfaces - 9.5.x - drupal

Primary tabs

Introduction to classes

A lot of the PHP code in Drupal is object oriented (OO), making use of PHP classes, interfaces, and traits. See the Objected-oriented programming conventions for more information.

See also

Objected-oriented programming conventions

File

core/core.api.php, line 1523

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
FormCacheInterface interface Drupal\Core\Form core/lib/Drupal/Core/Form/FormCacheInterface.php Provides an interface for the caching of a form and its form state. 2
FormCacheTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormCacheTest.php @coversDefaultClass \Drupal\Core\Form\FormCache @group Form
FormCacheTest class Drupal\KernelTests\Core\Form core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php Tests FormBuilder caching.
FormController abstract class Drupal\Core\Controller core/lib/Drupal/Core/Controller/FormController.php Common base class for form interstitial controllers. 4 3
FormController class Drupal\condition_test core/modules/system/tests/modules/condition_test/src/FormController.php Routing controller class for condition_test testing of condition forms. 1
FormDefaultHandlersTest class Drupal\KernelTests\Core\Form core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php Tests automatically added form handlers.
FormEditor class Drupal\quickedit\Plugin\InPlaceEditor core/modules/quickedit/src/Plugin/InPlaceEditor/FormEditor.php Defines the form in-place editor.
FormElement abstract class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/FormElement.php Provides a base class for form element plugins. 27 3
FormElement class Drupal\Core\Render\Annotation core/lib/Drupal/Core/Render/Annotation/FormElement.php Defines a form element plugin annotation object.
FormElementBase abstract class Drupal\config_translation\FormElement core/modules/config_translation/src/FormElement/FormElementBase.php Provides a common base class for form elements. 5
FormElementHelper class Drupal\Core\Form core/lib/Drupal/Core/Form/FormElementHelper.php Provides common functionality for form elements. 2
FormElementHelperTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php Tests the form element helper.
FormElementInlineErrorTest class Drupal\Tests\inline_form_errors\Kernel core/modules/inline_form_errors/tests/src/Kernel/FormElementInlineErrorTest.php Tests messages on form elements.
FormElementInterface interface Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/FormElementInterface.php Provides an interface for form element plugins. 1 1
FormElementLabelTest class Drupal\Tests\system\Kernel\Form core/modules/system/tests/src/Kernel/Form/FormElementLabelTest.php Tests for form_element_label theme hook.
FormElementMaxlengthTest class Drupal\Tests\system\Kernel\Form core/modules/system/tests/src/Kernel/Form/FormElementMaxlengthTest.php Tests the maxlength HTML attribute on form elements.
FormElementsRenderTest class Drupal\Tests\system\Kernel\Common core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php Performs integration tests on \Drupal::service('renderer')->render().
FormErrorHandler class Drupal\inline_form_errors core/modules/inline_form_errors/src/FormErrorHandler.php Produces inline form errors. 1
FormErrorHandler class Drupal\Core\Form core/lib/Drupal/Core/Form/FormErrorHandler.php Handles form errors. 1 1 2
FormErrorHandlerCKEditor5Test class Drupal\Tests\inline_form_errors\FunctionalJavascript core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditor5Test.php Tests the inline errors fragment link to a CKEditor5-enabled textarea.
FormErrorHandlerCKEditorTest class Drupal\Tests\ckeditor\FunctionalJavascript core/modules/ckeditor/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php Tests the inline errors fragment link to a CKEditor-enabled textarea.
FormErrorHandlerFileUploadTest class Drupal\Tests\inline_form_errors\Functional core/modules/inline_form_errors/tests/src/Functional/FormErrorHandlerFileUploadTest.php Tests file upload scenario's with Inline Form Errors.
FormErrorHandlerInterface interface Drupal\Core\Form core/lib/Drupal/Core/Form/FormErrorHandlerInterface.php Provides an interface for handling form errors. 1
FormErrorHandlerTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php @coversDefaultClass \Drupal\Core\Form\FormErrorHandler @group Form
FormErrorHandlerTest class Drupal\Tests\inline_form_errors\Unit core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php @coversDefaultClass \Drupal\inline_form_errors\FormErrorHandler @group InlineFormErrors
FormGroupingElementsTest class Drupal\FunctionalJavascriptTests\Core\Form core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php Tests for form grouping elements.
FormHelper class Drupal\Core\Form core/lib/Drupal/Core/Form/FormHelper.php Provides helpers to operate on forms. 5
FormHelperTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormHelperTest.php @coversDefaultClass \Drupal\Core\Form\FormHelper @group Form
FormInterface interface Drupal\Core\Form core/lib/Drupal/Core/Form/FormInterface.php Provides an interface for a Form. 39 39
FormJSAddMoreTest class Drupal\Tests\field\FunctionalJavascript core/modules/field/tests/src/FunctionalJavascript/FormJSAddMoreTest.php Tests add more behavior for a multiple value field.
FormModeAccessCheck class Drupal\field_ui\Access core/modules/field_ui/src/Access/FormModeAccessCheck.php Defines an access check for entity form mode routes. 2
FormObjectTest class Drupal\Tests\system\Kernel\Form core/modules/system/tests/src/Kernel/Form/FormObjectTest.php Tests building a form from an object.
FormObjectTest class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/FormObjectTest.php Tests building a form from an object.
FormOperations class Drupal\workspaces core/modules/workspaces/src/FormOperations.php Defines a class for reacting to form operations. 1
FormRouteEnhancer class Drupal\Core\Routing\Enhancer core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php Enhancer to add a wrapping controller for _form routes. 2
FormState class Drupal\Core\Form core/lib/Drupal/Core/Form/FormState.php Stores information about the state of a form. 77
FormStateDecoratorBase abstract class Drupal\Core\Form core/lib/Drupal/Core/Form/FormStateDecoratorBase.php Decorates another form state. 2 1
FormStateDecoratorBaseTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php @coversDefaultClass \Drupal\Core\Form\FormStateDecoratorBase
FormStateInterface interface Drupal\Core\Form core/lib/Drupal/Core/Form/FormStateInterface.php Provides an interface for an object containing the current state of a form. 3 882
FormStateTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormStateTest.php @coversDefaultClass \Drupal\Core\Form\FormState
FormStateValuesTrait trait Drupal\Core\Form core/lib/Drupal/Core/Form/FormStateValuesTrait.php Provides methods to manage form state values. 1
FormStateValuesTraitStub class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php
FormStateValuesTraitTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php @coversDefaultClass \Drupal\Core\Form\FormStateValuesTrait
FormStoragePageCacheTest class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php Tests form storage from cached pages.
FormSubmitter class Drupal\Core\Form core/lib/Drupal/Core/Form/FormSubmitter.php Provides submission processing for forms. 2
FormSubmitterInterface interface Drupal\Core\Form core/lib/Drupal/Core/Form/FormSubmitterInterface.php Provides an interface for processing form submissions. 2
FormSubmitterTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php @coversDefaultClass \Drupal\Core\Form\FormSubmitter @group Form
FormTest class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/FormTest.php Tests various form element validation mechanisms.
FormTest class Drupal\Tests\field\Functional core/modules/field/tests/src/Functional/FormTest.php Tests field form handling.
FormTestAlterForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestAlterForm.php Form builder for testing hook_form_alter() and hook_form_FORM_ID_alter(). 1

Other projects


Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.