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
DateTimeItemInterface interface Drupal\datetime\Plugin\Field\FieldType core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItemInterface.php Interface definition for Datetime items. 1 18
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 Note: Prophecy does not support magic methods. By subclassing and specifying an explicit method, Prophecy works.
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 10
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
DatetimeRangeViewUpdateTest class Drupal\Tests\datetime_range\Functional\Update core/modules/datetime_range/tests/src/Functional/Update/DatetimeRangeViewUpdateTest.php Test update of views with datetime_range filters.
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 Configure date and time settings. 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
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.
DbCommandBaseTester class Drupal\Tests\system\Kernel\Scripts core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php Concrete command implementation for testing base features.
DbDumpApplication class Drupal\Core\Command core/lib/Drupal/Core/Command/DbDumpApplication.php Provides a command to dump a database generation script. 2
DbDumpCommand class Drupal\Core\Command core/lib/Drupal/Core/Command/DbDumpCommand.php Provides a command to dump the current database to a script. 1
DbDumpCommandTest class Drupal\Tests\system\Kernel\Scripts core/modules/system/tests/src/Kernel/Scripts/DbDumpCommandTest.php Test that the DbDumpCommand works correctly.
DbDumpTest class Drupal\KernelTests\Core\Command core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php Tests for the database dump commands.
DbImportCommand class Drupal\Core\Command core/lib/Drupal/Core/Command/DbImportCommand.php Provides a command to import the current database from a script. 1
DbImportCommandTest class Drupal\Tests\system\Kernel\Scripts core/modules/system/tests/src/Kernel/Scripts/DbImportCommandTest.php Test that the DbImportCommand works correctly.
DbLog class Drupal\dblog\Logger core/modules/dblog/src/Logger/DbLog.php Logs events in the watchdog database table. 2
DblogClearLogConfirmForm class Drupal\dblog\Form core/modules/dblog/src/Form/DblogClearLogConfirmForm.php Provides a confirmation form before clearing out the logs. 1
DbLogController class Drupal\dblog\Controller core/modules/dblog/src/Controller/DbLogController.php Returns responses for dblog routes. 2
DbLogControllerTest class Drupal\Tests\dblog\Kernel core/modules/dblog/tests/src/Kernel/DbLogControllerTest.php Tests for the DbLogController class.
DblogFilterForm class Drupal\dblog\Form core/modules/dblog/src/Form/DblogFilterForm.php Provides the database logging filter form.
DblogFiltersAndFieldsUpgradeTest class Drupal\Tests\dblog\Functional\Update core/modules/dblog/tests/src/Functional/Update/DblogFiltersAndFieldsUpgradeTest.php Tests the upgrade path for views field and filter handlers.
DbLogFormInjectionTest class Drupal\Tests\dblog\Kernel core/modules/dblog/tests/src/Kernel/DbLogFormInjectionTest.php Tests serializing a form with an injected dblog logger instance.
DblogMessage class Drupal\dblog\Plugin\views\field core/modules/dblog/src/Plugin/views/field/DblogMessage.php Provides a field handler that renders a log event with replaced variables.
DblogNoLogsAvailableUpgradeTest class Drupal\Tests\dblog\Functional\Update core/modules/dblog/tests/src/Functional/Update/DblogNoLogsAvailableUpgradeTest.php Test the upgrade path of changing the empty text area for watchdog view.
DblogOperations class Drupal\dblog\Plugin\views\field core/modules/dblog/src/Plugin/views/field/DblogOperations.php Provides a field handler that renders operation link markup.
DblogRecentLogsUsingViewsUpdateTest class Drupal\Tests\dblog\Functional\Update core/modules/dblog/tests/src/Functional/Update/DblogRecentLogsUsingViewsUpdateTest.php Ensures that update hook that creates the watchdog view ran successfully.
DBLogResource class Drupal\dblog\Plugin\rest\resource core/modules/dblog/src/Plugin/rest/resource/DBLogResource.php Provides a resource for database watchdog log entries.
DbLogResourceTest class Drupal\Tests\dblog\Functional core/modules/dblog/tests/src/Functional/DbLogResourceTest.php Tests the watchdog database log resource.
DbLogTest class Drupal\Tests\dblog\Kernel core/modules/dblog/tests/src/Kernel/DbLogTest.php Generate events and verify dblog entries.
DbLogTest class Drupal\Tests\dblog\Functional core/modules/dblog/tests/src/Functional/DbLogTest.php Generate events and verify dblog entries; verify user access to log reports based on permissions. 1
DblogTypes class Drupal\dblog\Plugin\views\filter core/modules/dblog/src/Plugin/views/filter/DblogTypes.php Exposes log types to views module.
DbLogViewsTest class Drupal\Tests\dblog\Functional core/modules/dblog/tests/src/Functional/DbLogViewsTest.php Generate events and verify dblog entries; verify user access to log reports based on permissions. Using the dblog UI generated by a View.
DbToolsApplication class Drupal\Core\Command core/lib/Drupal/Core/Command/DbToolsApplication.php Provides a command to import a database generation script. 2
DbToolsApplicationTest class Drupal\Tests\system\Kernel\Scripts core/modules/system/tests/src/Kernel/Scripts/DbToolsApplicationTest.php Test that the DbToolsApplication works correctly.
DbUpdateAccessCheck class Drupal\system\Access core/modules/system/src/Access/DbUpdateAccessCheck.php Access check for database update routes. 2
DbUpdateController class Drupal\system\Controller core/modules/system/src/Controller/DbUpdateController.php Controller routines for database update routes.
DbUpdateNegotiator class Drupal\system\Theme core/modules/system/src/Theme/DbUpdateNegotiator.php Sets the active theme for the database update pages. 2
DbUpdatesTrait

in drupal:8.4.0 and is removed from drupal:9.0.0. Use \Drupal\FunctionalTests\Update\DbUpdatesTrait.

trait Drupal\system\Tests\Update core/modules/system/src/Tests/Update/DbUpdatesTrait.php Provides methods to conditionally enable db update functions and apply pending db updates through the Update UI.
DbUpdatesTrait trait Drupal\Tests\system\Functional\Update core/modules/system/tests/src/Functional/Update/DbUpdatesTrait.php Provides methods to conditionally enable db update functions and apply pending db updates through the Update UI. 1

Other projects


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