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
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 abstract class Drupal\Tests\datetime\Functional core/modules/datetime/tests/src/Functional/DateTestBase.php Provides a base class for testing Datetime field functionality. 3 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 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 Provides a test class for testing DrupalDateTime.
DateTimeItem class Drupal\datetime\Plugin\Field\FieldType core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php Plugin implementation of the 'datetime' field type. 1 22
DateTimeItemInterface interface Drupal\datetime\Plugin\Field\FieldType core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItemInterface.php Interface definition for Datetime items. 1 19
DateTimeItemTest class Drupal\Tests\datetime\Kernel core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php Tests the new entity API for the date field type.
DateTimeNormalizer class Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/DateTimeNormalizer.php Converts values for datetime objects to RFC3339 and from common formats. 2 1
DateTimeNormalizerTest class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php Unit test coverage for @DataTypes implementing DateTimeInterface.
DateTimeNormalizerTestDrupalDateTime class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php Provides a test class for testing DrupalDateTime.
DateTimePlainFormatter class Drupal\datetime\Plugin\Field\FieldFormatter core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php Plugin implementation of the 'Plain' formatter for 'datetime' fields. 1 1
DateTimePlus class Drupal\Component\Datetime core/lib/Drupal/Component/Datetime/DateTimePlus.php Wraps DateTime(). 1 11
DateTimePlusTest class Drupal\Tests\Component\Datetime core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php @coversDefaultClass \Drupal\Component\Datetime\DateTimePlus @group Datetime
DateTimeRangeTrait trait Drupal\datetime_range core/modules/datetime_range/src/DateTimeRangeTrait.php Provides friendly methods for datetime range. 3
DateTimeSchemaTest class Drupal\Tests\datetime\Kernel\Views core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php Tests the Drupal\datetime\Plugin\views schemas.
DateTimeTest class Drupal\Tests\system\Functional\System core/modules/system/tests/src/Functional/System/DateTimeTest.php Test date formatting and time zone handling, including daylight saving time.
DateTimeTimeAgoFormatter class Drupal\datetime\Plugin\Field\FieldFormatter core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeTimeAgoFormatter.php Plugin implementation of the 'Time ago' formatter for 'datetime' fields.
DateTimeTimeAgoFormatterTest class Drupal\Tests\datetime\Functional core/modules/datetime/tests/src/Functional/DateTimeTimeAgoFormatterTest.php Tests the functionality of DateTimeTimeAgoFormatter field formatter.
DateTimeWidgetBase class Drupal\datetime\Plugin\Field\FieldWidget core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php Base class for the 'datetime_*' widgets. 3 1
DateTimeWidgetTest class Drupal\Tests\datetime\Functional core/modules/datetime/tests/src/Functional/DateTimeWidgetTest.php Tests Datetime widgets functionality.
DayDate class Drupal\datetime\Plugin\views\argument core/modules/datetime/src/Plugin/views/argument/DayDate.php Argument handler for a day.
DayDate class Drupal\views\Plugin\views\argument core/modules/views/src/Plugin/views/argument/DayDate.php Argument handler for a day (DD)
DbCommandBase class Drupal\Core\Command core/lib/Drupal/Core/Command/DbCommandBase.php Base command that abstracts handling of database connection arguments. 3 1
DbCommandBaseTest class Drupal\Tests\system\Kernel\Scripts core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php Test that the DbToolsApplication works correctly.

Other projects


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