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
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.
DateRangeFieldTest class Drupal\Tests\datetime_range\FunctionalJavascript core/modules/datetime_range/tests/src/FunctionalJavascript/DateRangeFieldTest.php Tests Daterange field.
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. 8
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.
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
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
DatetimeHooks class Drupal\datetime\Hook core/modules/datetime/src/Hook/DatetimeHooks.php Hook implementations for datetime.
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 23
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 9
DateTimePlusTest class Drupal\Tests\Component\Datetime core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php @coversDefaultClass \Drupal\Component\Datetime\DateTimePlus @group Datetime
DateTimeRangeConstantsInterface interface Drupal\datetime_range core/modules/datetime_range/src/DateTimeRangeConstantsInterface.php Declares constants used in the datetime range module. 2
DatetimeRangeHooks class Drupal\datetime_range\Hook core/modules/datetime_range/src/Hook/DatetimeRangeHooks.php Hook implementations for datetime_range.
DatetimeRangeTestHooks class Drupal\datetime_range_test\Hook core/modules/datetime_range/tests/modules/datetime_range_test/src/Hook/DatetimeRangeTestHooks.php Hook implementations for datetime_range_test.
DateTimeRangeTrait trait Drupal\datetime_range core/modules/datetime_range/src/DateTimeRangeTrait.php Provides friendly methods for datetime range. 3
DatetimeRangeViewsHooks class Drupal\datetime_range\Hook core/modules/datetime_range/src/Hook/DatetimeRangeViewsHooks.php Hook implementations for datetime_range.
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.
DatetimeViewsHooks class Drupal\datetime\Hook core/modules/datetime/src/Hook/DatetimeViewsHooks.php Hook implementations for datetime.

Other projects


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