Classes, traits, and interfaces - main - 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 1529

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
Form class Drupal\router_test core/modules/system/tests/modules/router_test_directory/src/Form.php Form to test _form routing. 1
FormActionXssTest class Drupal\KernelTests\Core\Form core/tests/Drupal/KernelTests/Core/Form/FormActionXssTest.php Ensures that a form's action attribute can't be exploited with XSS.
FormAjaxException class Drupal\Core\Form core/lib/Drupal/Core/Form/FormAjaxException.php Custom exception to break out of AJAX form processing. 2
FormAjaxResponseBuilder class Drupal\Core\Form core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php Builds an AJAX form response. 1 2
FormAjaxResponseBuilderInterface interface Drupal\Core\Form core/lib/Drupal/Core/Form/FormAjaxResponseBuilderInterface.php Provides an interface for building AJAX form responses. 1 2
FormAjaxResponseBuilderTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php Tests Drupal\Core\Form\FormAjaxResponseBuilder.
FormAjaxSubscriber class Drupal\Core\Form\EventSubscriber core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php Wraps AJAX form submissions that are triggered via an exception. 1 2
FormAjaxSubscriberTest class Drupal\Tests\Core\Form\EventSubscriber core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php Tests Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber.
FormatDate class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/FormatDate.php Converts date/datetime from one format to another. 1
FormatDateTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/FormatDateTest.php Tests the format date process plugin.
FormatDateTest class Drupal\Tests\system\Functional\Common core/modules/system/tests/src/Functional/Common/FormatDateTest.php Tests the DateFormatterInterface::format() function.
FormatPluralUpdateTest class Drupal\Tests\views\Functional\Update core/modules/views/tests/src/Functional/Update/FormatPluralUpdateTest.php Tests the upgrade path for converting format_plural from integer to boolean.
FormattableMarkup class Drupal\Component\Render core/lib/Drupal/Component/Render/FormattableMarkup.php Formats a string for HTML display by replacing variable placeholders. 1 61
FormattableMarkupKernelTest class Drupal\KernelTests\Component\Render core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php Provides a test covering integration of FormattableMarkup with other systems.
FormattableMarkupTest class Drupal\Tests\Component\Render core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php Tests the TranslatableMarkup class.
FormattedDateDiff class Drupal\Core\Datetime core/lib/Drupal/Core/Datetime/FormattedDateDiff.php Contains a formatted time difference. 1
FormatterBase abstract class Drupal\Core\Field core/lib/Drupal/Core/Field/FormatterBase.php Base class for 'Field formatter' plugin implementations. 33 33
FormatterInterface interface Drupal\Core\Field core/lib/Drupal/Core/Field/FormatterInterface.php Interface definition for field formatter plugins. 1 3 1
FormatterPluginManager class Drupal\Core\Field core/lib/Drupal/Core/Field/FormatterPluginManager.php Plugin type manager for field formatters. 6 2
FormatterPluginManagerTest class Drupal\Tests\field\Kernel core/modules/field/tests/src/Kernel/FormatterPluginManagerTest.php Tests the field formatter plugin manager.
FormBase abstract class Drupal\Core\Form core/lib/Drupal/Core/Form/FormBase.php Provides a base class for forms. 153 150
FormBuilder class Drupal\Core\Form core/lib/Drupal/Core/Form/FormBuilder.php Provides form building and processing. 3 2
FormBuilderInterface interface Drupal\Core\Form core/lib/Drupal/Core/Form/FormBuilderInterface.php Provides an interface for form building and processing. 1 35
FormBuilderTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php Tests Drupal\Core\Form\FormBuilder.
FormCache class Drupal\Core\Form core/lib/Drupal/Core/Form/FormCache.php Encapsulates the caching of a form and its form state. 1 2
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 1
FormCacheTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormCacheTest.php Tests Drupal\Core\Form\FormCache.
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. 3 2
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.
FormElement class Drupal\Core\Render\Attribute core/lib/Drupal/Core/Render/Attribute/FormElement.php Defines a form element plugin attribute object. 38
FormElement

in drupal:10.3.0 and is removed from drupal:12.0.0. use \Drupal\Core\Render\Element\FormElementBase instead.

abstract class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/FormElement.php Provides a base class for form element plugins. 1 1
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\Core\Render\Element core/lib/Drupal/Core/Render/Element/FormElementBase.php Provides a base class for form element plugins. 28 3
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 2 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.
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 2
FormErrorHandlerTest class Drupal\Tests\inline_form_errors\Unit core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php Tests Drupal\inline_form_errors\FormErrorHandler.
FormErrorHandlerTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php Tests Drupal\Core\Form\FormErrorHandler.

Other projects


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