Classes, traits, and interfaces - 8.9.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 1511

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
DateFormatResourceTestBase abstract class Drupal\FunctionalTests\Rest core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php ResourceTestBase for DateFormat entity. 10 4
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 2
DateFormatterInterface interface Drupal\Core\Datetime core/lib/Drupal/Core/Datetime/DateFormatterInterface.php Provides an interface defining a date formatter. 1 37
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.
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.
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.
DateRangeDefaultWidget class Drupal\datetime_range\Plugin\Field\FieldWidget core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeDefaultWidget.php Plugin implementation of the 'daterange_default' widget.
DateRangeFieldItemList class Drupal\datetime_range\Plugin\Field\FieldType core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeFieldItemList.php Represents a configurable entity daterange field.
DateRangeFieldTest class Drupal\Tests\datetime_range\Functional core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php Tests Daterange field functionality.
DateRangeItem class Drupal\datetime_range\Plugin\Field\FieldType core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php Plugin implementation of the 'daterange' field type. 7
DateRangeItemTest class Drupal\Tests\datetime_range\Kernel core/modules/datetime_range/tests/src/Kernel/DateRangeItemTest.php Test datetime range field type via API.
DateRangePlainFormatter class Drupal\datetime_range\Plugin\Field\FieldFormatter core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangePlainFormatter.php Plugin implementation of the 'Plain' formatter for 'daterange' fields.
DateRangeWidgetBase class Drupal\datetime_range\Plugin\Field\FieldWidget core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeWidgetBase.php Base class for the 'daterange_*' widgets. 2
DateSqlInterface interface Drupal\views\Plugin\views\query core/modules/views/src/Plugin/views/query/DateSqlInterface.php Defines an interface for handling date queries with SQL. 3 1
DateTest class Drupal\Tests\Core\Datetime core/tests/Drupal/Tests/Core/Datetime/DateTest.php @coversDefaultClass \Drupal\Core\Datetime\DateFormatter @group Datetime
DateTestBase

in drupal:8.4.0 and is removed from drupal:9.0.0. Use \Drupal\Tests\BrowserTestBase instead.

abstract class Drupal\datetime\Tests core/modules/datetime/src/Tests/DateTestBase.php Provides a base class for testing Datetime field functionality.
DateTestBase abstract class Drupal\Tests\datetime\Functional core/modules/datetime/tests/src/Functional/DateTestBase.php Provides a base class for testing Datetime field functionality. 2 1
Datetime class Drupal\Core\Datetime\Element core/lib/Drupal/Core/Datetime/Element/Datetime.php Provides a datetime element. 1
DateTimeComputed class Drupal\datetime core/modules/datetime/src/DateTimeComputed.php A computed property for dates of date time field items. 1
DateTimeCustomFormatter class Drupal\datetime\Plugin\Field\FieldFormatter core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeCustomFormatter.php Plugin implementation of the 'Custom' formatter for 'datetime' fields. 1 1
DateTimeDatelistWidget class Drupal\datetime\Plugin\Field\FieldWidget core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php Plugin implementation of the 'datetime_datelist' widget.
DateTimeDefaultFormatter class Drupal\datetime\Plugin\Field\FieldFormatter core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php Plugin implementation of the 'Default' formatter for 'datetime' fields. 1 1
DateTimeDefaultWidget class Drupal\datetime\Plugin\Field\FieldWidget core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php Plugin implementation of the 'datetime_default' widget.
DatetimeElementFormTest class Drupal\KernelTests\Core\Datetime core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php Tests DatetimeElement functionality.
DateTimeFieldItemList class Drupal\datetime\Plugin\Field\FieldType core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php Represents a configurable entity datetime field. 1 1
DateTimeFieldRdfaTest class Drupal\Tests\rdf\Kernel\Field core/modules/rdf/tests/src/Kernel/Field/DateTimeFieldRdfaTest.php Tests RDFa output by datetime field formatters.
DateTimeFieldTest class Drupal\Tests\datetime\Functional core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php Tests Datetime field functionality.
DateTimeFormatConstraint class Drupal\datetime\Plugin\Validation\Constraint core/modules/datetime/src/Plugin/Validation/Constraint/DateTimeFormatConstraint.php Validation constraint for DateTime items to ensure the format is correct.
DateTimeFormatConstraintValidator class Drupal\datetime\Plugin\Validation\Constraint core/modules/datetime/src/Plugin/Validation/Constraint/DateTimeFormatConstraintValidator.php Constraint validator for DateTime items to ensure the format is correct.
DateTimeFormatterBase abstract class Drupal\datetime\Plugin\Field\FieldFormatter core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php Base class for 'DateTime Field formatter' plugin implementations. 3
DateTimeFormInjectionTest class Drupal\Tests\datetime\Kernel core/modules/datetime/tests/src/Kernel/DateTimeFormInjectionTest.php Tests serializing a form with an injected datetime instance.
DateTimeHandlerTestBase

in drupal:8.4.0 and is removed from drupal:9.0.0. Use \Drupal\Tests\BrowserTestBase.

abstract class Drupal\datetime\Tests\Views core/modules/datetime/src/Tests/Views/DateTimeHandlerTestBase.php Base class for testing datetime handlers.
DateTimeHandlerTestBase abstract class Drupal\Tests\datetime\Kernel\Views core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php Base class for testing datetime handlers. 6 1
DateTimeInterface interface Drupal\Core\TypedData\Type core/lib/Drupal/Core/TypedData/Type/DateTimeInterface.php Interface for dates, optionally including a time. 2 8
DateTimeIso8601 class Drupal\Core\TypedData\Plugin\DataType core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php A data type for ISO 8601 date strings. 3
DateTimeIso8601Normalizer class Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/DateTimeIso8601Normalizer.php Converts values for the DateTimeIso8601 data type to RFC3339. 1 2
DateTimeIso8601NormalizerTest class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php Unit test coverage for the "datetime_iso8601" @DataType.
DateTimeIso8601NormalizerTestDrupalDateTime class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php Note: Prophecy does not support magic methods. By subclassing and specifying an explicit method, Prophecy works.
DateTimeItem class Drupal\datetime\Plugin\Field\FieldType core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php Plugin implementation of the 'datetime' field type. 1 24

Other projects


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