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
DatabaseTestBase abstract class Drupal\Tests\system\Functional\Database core/modules/system/tests/src/Functional/Database/DatabaseTestBase.php Base class for databases database tests. 3
DatabaseTestController class Drupal\database_test\Controller core/modules/system/tests/modules/database_test/src/Controller/DatabaseTestController.php Controller routines for database_test routes.
DatabaseTestForm class Drupal\database_test\Form core/modules/system/tests/modules/database_test/src/Form/DatabaseTestForm.php Form controller for database_test module. 1
DatabaseVersionCheckUpdateTest class Drupal\Tests\system\Functional\Update core/modules/system/tests/src/Functional/Update/DatabaseVersionCheckUpdateTest.php Tests that updates fail if the database does not meet the minimum version.
DatabaseWebTestBase

in drupal:8.4.0 and is removed from drupal:9.0.0. Instead use \Drupal\Tests\system\Functional\Database\DatabaseTestBase.

abstract class Drupal\system\Tests\Database core/modules/system/src/Tests/Database/DatabaseWebTestBase.php Base class for databases database tests.
DataCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/DataCommand.php An AJAX command for implementing jQuery's data() method. 3
DataDefinition class Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataDefinition.php A typed data definition class for defining data based on defined data types. 5 52
DataDefinitionInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php Interface for data definitions. 4 12
DataEntityRow class Drupal\rest\Plugin\views\row core/modules/rest/src/Plugin/views/row/DataEntityRow.php Plugin which displays entities as raw data.
DataFieldRow class Drupal\rest\Plugin\views\row core/modules/rest/src/Plugin/views/row/DataFieldRow.php Plugin which displays fields as raw data.
DataNormalizer class Drupal\jsonapi\Normalizer core/modules/jsonapi/src/Normalizer/DataNormalizer.php Normalizes JSON:API Data objects. 2
DataReferenceBase abstract class Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataReferenceBase.php Base class for typed data references. 2 2
DataReferenceDefinition class Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataReferenceDefinition.php A typed data definition class for defining references. 4
DataReferenceDefinitionInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataReferenceDefinitionInterface.php Interface for typed data references. 1 6
DataReferenceInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/DataReferenceInterface.php Interface for typed data references. 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\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 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. 2
DateField

in drupal:8.4.0 and is removed from drupal:9.0.0. Use \Drupal\datetime\Plugin\migrate\field\DateField instead.

class Drupal\datetime\Plugin\migrate\field\d6 core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php Plugin annotation @MigrateField( id = "date", type_map = { "date" = "datetime", "datestamp" = "timestamp", "datetime" = "datetime", }, core = {6}, source_module = "date", destination_module = "datetime", weight = 9999999, ) 1
DateFieldLegacyTest class Drupal\Tests\datetime\Unit\Plugin\migrate\field\d6 core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldLegacyTest.php @group migrate @group legacy
DateFieldLegacyTest class Drupal\Tests\datetime\Unit\Plugin\migrate\field core/modules/datetime/tests/src/Unit/Plugin/migrate/field/DateFieldLegacyTest.php Tests legacy methods on the date_field plugin.
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.
DateFieldTest class Drupal\Tests\datetime\Unit\Plugin\migrate\field\d6 core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldTest.php @group migrate @group legacy 1
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. 20
DateFormatAccessControlHandler class Drupal\system core/modules/system/src/DateFormatAccessControlHandler.php Defines the access control handler for the date format entity type.
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
DateFormatHalJsonAnonTest class Drupal\FunctionalTests\Hal core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonAnonTest.php @group hal
DateFormatHalJsonBasicAuthTest class Drupal\FunctionalTests\Hal core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonBasicAuthTest.php @group hal
DateFormatHalJsonCookieTest class Drupal\FunctionalTests\Hal core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonCookieTest.php @group hal
DateFormatInterface interface Drupal\Core\Datetime core/lib/Drupal/Core/Datetime/DateFormatInterface.php Provides an interface defining a date format. 1 1
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

in drupal:8.6.0 and is removed from drupal:9.0.0. Use Drupal\FunctionalTests\Rest\DateFormatResourceTestBase instead.

abstract class Drupal\Tests\rest\Functional\EntityResource\DateFormat core/modules/rest/tests/src/Functional/EntityResource/DateFormat/DateFormatResourceTestBase.php

Other projects


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