Classes, traits, and interfaces - 11.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 1518

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
DataReferenceDefinition class Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataReferenceDefinition.php A typed data definition class for defining references. 6
DataReferenceDefinitionInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataReferenceDefinitionInterface.php Interface for typed data references. 1 7
DataReferenceInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataReferenceInterface.php Interface for typed data references. 1 1
DataReferenceTargetDefinition class Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataReferenceTargetDefinition.php A typed data definition class for the entity reference target_id property. 5
DataType class Drupal\Core\TypedData\Attribute core/lib/Drupal/Core/TypedData/Attribute/DataType.php Defines a data type attribute. 25
DataType class Drupal\Core\TypedData\Annotation core/lib/Drupal/Core/TypedData/Annotation/DataType.php Defines a data type annotation object. 1 1
Date class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/Date.php Provides a form element for date or time selection.
Date class Drupal\datetime\Plugin\views\sort core/modules/datetime/src/Plugin/views/sort/Date.php Basic sort handler for datetime fields.
Date class Drupal\datetime\Plugin\views\filter core/modules/datetime/src/Plugin/views/filter/Date.php Date/time views filter.
Date class Drupal\datetime\Plugin\views\argument core/modules/datetime/src/Plugin/views/argument/Date.php Abstract argument handler for dates. 6
Date class Drupal\views\Plugin\views\sort core/modules/views/src/Plugin/views/sort/Date.php Basic sort handler for dates. 2 2
Date class Drupal\views\Plugin\views\field core/modules/views/src/Plugin/views/field/Date.php A handler to provide proper displays for dates. 3 3
Date class Drupal\views\Plugin\views\filter core/modules/views/src/Plugin/views/filter/Date.php Filter to handle dates stored as a timestamp. 2 2
Date class Drupal\views\Plugin\views\argument core/modules/views/src/Plugin/views/argument/Date.php Argument handler for dates. 7 1
DateElementBase abstract class Drupal\Core\Datetime\Element core/lib/Drupal/Core/Datetime/Element/DateElementBase.php Provides a base class for date elements. 2
DateField class Drupal\datetime\Plugin\migrate\field core/modules/datetime/src/Plugin/migrate/field/DateField.php Provides a field plugin for date and time fields. 1
DateFieldTest class Drupal\Tests\datetime\Unit\Plugin\migrate\field core/modules/datetime/tests/src/Unit/Plugin/migrate/field/DateFieldTest.php Provides unit tests for the DateField Plugin.
DateFilterTest class Drupal\Tests\datetime\Functional core/modules/datetime/tests/src/Functional/DateFilterTest.php Test exposed datetime filters functionality.
DateFormat class Drupal\config_translation\FormElement core/modules/config_translation/src/FormElement/DateFormat.php Defines the date format element for the configuration translation interface.
DateFormat class Drupal\Core\Datetime\Entity core/lib/Drupal/Core/Datetime/Entity/DateFormat.php Defines the Date Format configuration entity class. 29
DateFormatAccessControlHandler class Drupal\system core/modules/system/src/DateFormatAccessControlHandler.php Defines the access control handler for the date format entity type. 1
DateFormatAccessControlHandlerTest class Drupal\Tests\system\Kernel core/modules/system/tests/src/Kernel/DateFormatAccessControlHandlerTest.php @coversDefaultClass \Drupal\system\DateFormatAccessControlHandler @group system
DateFormatAddForm class Drupal\system\Form core/modules/system/src/Form/DateFormatAddForm.php Provides a form for adding a date format.
DateFormatDeleteForm class Drupal\system\Form core/modules/system/src/Form/DateFormatDeleteForm.php Builds a form to delete a date format.
DateFormatEditForm class Drupal\system\Form core/modules/system/src/Form/DateFormatEditForm.php Provides a form for editing a date format.
DateFormatFormBase abstract class Drupal\system\Form core/modules/system/src/Form/DateFormatFormBase.php Provides a base form for date formats. 2
DateFormatInterface interface Drupal\Core\Datetime core/lib/Drupal/Core/Datetime/DateFormatInterface.php Provides an interface defining a date format. 1 2
DateFormatJsonAnonTest class Drupal\FunctionalTests\Rest core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonAnonTest.php @group rest
DateFormatJsonBasicAuthTest class Drupal\FunctionalTests\Rest core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonBasicAuthTest.php @group rest
DateFormatJsonCookieTest class Drupal\FunctionalTests\Rest core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonCookieTest.php @group rest
DateFormatListBuilder class Drupal\system core/modules/system/src/DateFormatListBuilder.php Defines a class to build a listing of date format entities.
DateFormatResourceTestBase abstract class Drupal\FunctionalTests\Rest core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php ResourceTestBase for DateFormat entity. 6
DateFormatsLockedTest class Drupal\Tests\system\Functional\System core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php Tests the locked functionality of date formats.
DateFormatsMachineNameTest class Drupal\Tests\system\Functional\System core/modules/system/tests/src/Functional/System/DateFormatsMachineNameTest.php Tests validity of date format machine names.
DateFormatter class Drupal\Core\Datetime core/lib/Drupal/Core/Datetime/DateFormatter.php Provides a service to handle various date related functionality. 1
DateFormatterInterface interface Drupal\Core\Datetime core/lib/Drupal/Core/Datetime/DateFormatterInterface.php Provides an interface defining a date formatter. 1 40
DateFormatterTest class Drupal\KernelTests\Core\Datetime core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php Tests date formatting.
DateFormatTest class Drupal\Tests\system\FunctionalJavascript\System core/modules/system/tests/src/FunctionalJavascript/System/DateFormatTest.php Tests that date formats UI with JavaScript enabled.
DateFormatTest class Drupal\Tests\jsonapi\Functional core/modules/jsonapi/tests/src/Functional/DateFormatTest.php JSON:API integration test for the "DateFormat" config entity type.
DateFormatValidationTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/DateFormatValidationTest.php Tests validation of date_format entities.
DateFormatXmlAnonTest class Drupal\FunctionalTests\Rest core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlAnonTest.php @group rest
DateFormatXmlBasicAuthTest class Drupal\FunctionalTests\Rest core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlBasicAuthTest.php @group rest
DateFormatXmlCookieTest class Drupal\FunctionalTests\Rest core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlCookieTest.php @group rest
DateHelper class Drupal\Core\Datetime core/lib/Drupal/Core/Datetime/DateHelper.php Defines Gregorian Calendar date values. 2
DateHelperTest class Drupal\Tests\Core\Datetime core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php @coversDefaultClass \Drupal\Core\Datetime\DateHelper @group Datetime
Datelist class Drupal\Core\Datetime\Element core/lib/Drupal/Core/Datetime/Element/Datelist.php Provides a datelist element.
DatelistElementFormTest class Drupal\KernelTests\Core\Datetime core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php Tests Datelist functionality.
DateRangeCustomFormatter class Drupal\datetime_range\Plugin\Field\FieldFormatter core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangeCustomFormatter.php Plugin implementation of the 'Custom' formatter for 'daterange' fields.
DateRangeDatelistWidget class Drupal\datetime_range\Plugin\Field\FieldWidget core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeDatelistWidget.php Plugin implementation of the 'daterange_datelist' widget.
DateRangeDefaultFormatter class Drupal\datetime_range\Plugin\Field\FieldFormatter core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangeDefaultFormatter.php Plugin implementation of the 'Default' formatter for 'daterange' fields.

Other projects


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