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
DrupalKernelInterface interface Drupal\Core core/lib/Drupal/Core/DrupalKernelInterface.php The interface for DrupalKernel, the core of Drupal. 1 8
DrupalKernelSiteTest class Drupal\KernelTests\Core\DrupalKernel core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php Tests site-specific service overrides.
DrupalKernelTest class Drupal\KernelTests\Core\DrupalKernel core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php Tests DIC compilation to disk.
DrupalKernelTest class Drupal\Tests\Core\DrupalKernel core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php @coversDefaultClass \Drupal\Core\DrupalKernel @group DrupalKernel
DrupalLink class Drupal\ckeditor\Plugin\CKEditorPlugin core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalLink.php Defines the "drupallink" plugin.
DrupalListener class Drupal\TestTools\PhpUnitCompatibility\PhpUnit6 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit6/DrupalListener.php Listens to PHPUnit test runs.
DrupalListener class Drupal\TestTools\PhpUnitCompatibility\PhpUnit7 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit7/DrupalListener.php Listens to PHPUnit test runs.
DrupalLogErrorTest class Drupal\Tests\Core\Error core/tests/Drupal/Tests/Core/Error/DrupalLogErrorTest.php Tests logging of errors in core/error.inc.
DrupalMedia class Drupal\media\Plugin\CKEditorPlugin core/modules/media/src/Plugin/CKEditorPlugin/DrupalMedia.php Defines the "drupalmedia" plugin.
DrupalMediaLibrary class Drupal\media_library\Plugin\CKEditorPlugin core/modules/media_library/src/Plugin/CKEditorPlugin/DrupalMediaLibrary.php Defines the "drupalmedialibrary" plugin.
DrupalMessengerServiceTest class Drupal\Tests\system\Functional\Bootstrap core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php Tests the Messenger service.
DrupalMinkClient class Drupal\BuildTests\Framework core/tests/Drupal/BuildTests/Framework/DrupalMinkClient.php Extend the Mink client for Drupal use-cases. 1 1
DrupalMinkClientTest class Drupal\BuildTests\Framework\Tests core/tests/Drupal/BuildTests/Framework/Tests/DrupalMinkClientTest.php Test \Drupal\BuildTests\Framework\DrupalMinkClient.
DrupalPackageBuilder abstract class Drupal\Composer\Generator\Builder composer/Generator/Builder/DrupalPackageBuilder.php Base class that includes helpful utility routine for Drupal builder classes. 3
DrupalPinnedDevDependenciesBuilder class Drupal\Composer\Generator\Builder composer/Generator/Builder/DrupalPinnedDevDependenciesBuilder.php Builder to produce metapackage for drupal/core-dev-pinned. 3
DrupalSelenium2Driver class Drupal\FunctionalJavascriptTests core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php Provides a driver for Selenium testing. 1
DrupalSelenium2DriverTest class Drupal\FunctionalJavascriptTests\Tests core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php Tests the DrupalSelenium2Driver methods.
DrupalSetMessageTest class Drupal\KernelTests\Core\Common core/tests/Drupal/KernelTests/Core/Common/DrupalSetMessageTest.php @covers ::drupal_set_message @group Common @group legacy
DrupalSqlBase abstract class Drupal\migrate_drupal\Plugin\migrate\source core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php A base class for source plugins using a Drupal database as a source. 71 69
DrupalSqlBaseTest class Drupal\Tests\migrate_drupal\Unit\source core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php @coversDefaultClass Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase @group migrate_drupal
DrupalStandardsListenerDeprecatedClass class Drupal\deprecation_test\Deprecation core/modules/system/tests/modules/deprecation_test/src/Deprecation/DrupalStandardsListenerDeprecatedClass.php Fixture class for use by DrupalStandardsListenerDeprecationTest.
DrupalStandardsListenerDeprecationTest class Drupal\Tests\Core\Listeners core/tests/Drupal/Tests/Core/Listeners/DrupalStandardsListenerDeprecationTest.php Test deprecation error handling by DrupalStandardsListener.
DrupalStandardsListenerTrait trait Drupal\Tests\Listeners core/tests/Drupal/Tests/Listeners/DrupalStandardsListenerTrait.php Listens for PHPUnit tests and fails those with invalid coverage annotations. 2
DrupalTest class Drupal\Tests\Core core/tests/Drupal/Tests/Core/DrupalTest.php Tests the Drupal class.
DrupalTranslator class Drupal\Core\Validation core/lib/Drupal/Core/Validation/DrupalTranslator.php Translates strings using Drupal's translation system. 2
DummyAjaxFormatter class Drupal\image_module_test\Plugin\Field\FieldFormatter core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldFormatter/DummyAjaxFormatter.php Empty renderer for a dummy field with an AJAX handler.
DummyAjaxItem class Drupal\image_module_test\Plugin\Field\FieldType core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldType/DummyAjaxItem.php Defines a dummy field containing an AJAX handler.
DummyAjaxWidget class Drupal\image_module_test\Plugin\Field\FieldWidget core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldWidget/DummyAjaxWidget.php Default widget for Dummy AJAX test.
DummyDestination class Drupal\migrate_events_test\Plugin\migrate\destination core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php Plugin annotation @MigrateDestination( id = "dummy", requirements_met = true )
DummyImageFormatter class Drupal\image_module_test\Plugin\Field\FieldFormatter core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldFormatter/DummyImageFormatter.php Plugin implementation of the Dummy image formatter.
DummyQueryTrait trait Drupal\migrate\Plugin\migrate\source core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.php Provides a dummy select query object for source plugins. 3
DummyReadOnlyStreamWrapper class Drupal\file_test\StreamWrapper core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php Helper class for testing the stream wrapper registry. 2 2
DummyRemoteReadOnlyStreamWrapper class Drupal\file_test\StreamWrapper core/modules/file/tests/file_test/src/StreamWrapper/DummyRemoteReadOnlyStreamWrapper.php Dummy read-only remote stream wrapper (dummy-remote-readonly://). 1
DummyRemoteStreamWrapper class Drupal\file_test\StreamWrapper core/modules/file/tests/file_test/src/StreamWrapper/DummyRemoteStreamWrapper.php Helper class for testing the stream wrapper registry. 1 2
DummyStreamWrapper class Drupal\file_test\StreamWrapper core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php Helper class for testing the stream wrapper registry. 1 2
DuplicateContextualLinksTest class Drupal\Tests\contextual\FunctionalJavascript core/modules/contextual/tests/src/FunctionalJavascript/DuplicateContextualLinksTest.php Tests the UI for correct contextual links.
DuplicateTest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/DuplicateTest.php Tests the UI for view duplicate tool.
DurationInterface interface Drupal\Core\TypedData\Type core/lib/Drupal/Core/TypedData/Type/DurationInterface.php Interface for durations. 2 4
DurationIso8601 class Drupal\Core\TypedData\Plugin\DataType core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php The duration ISO8601 data type.
DynamicallyFieldableEntityStorageInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/DynamicallyFieldableEntityStorageInterface.php A storage that supports entity types with dynamic field definitions. 1 3
DynamicallyFieldableEntityStorageSchemaInterface interface Drupal\Core\Entity\Schema core/lib/Drupal/Core/Entity/Schema/DynamicallyFieldableEntityStorageSchemaInterface.php A storage schema that supports entity types with dynamic field definitions. 2 3
DynamicEntityTypeParamConverterTrait trait Drupal\Core\ParamConverter core/lib/Drupal/Core/ParamConverter/DynamicEntityTypeParamConverterTrait.php Provides a trait to replace dynamic entity types in routes.
DynamicLocalTasks class Drupal\media\Plugin\Derivative core/modules/media/src/Plugin/Derivative/DynamicLocalTasks.php Generates media-related local tasks. 1
DynamicLocalTasks class Drupal\content_moderation\Plugin\Derivative core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php Generates moderation-related local tasks. 1
DynamicMenuLinkMock class Drupal\Tests\Core\Menu core/tests/Drupal/Tests/Core/Menu/DynamicMenuLinkMock.php Defines a mock implementation of a dynamic menu link used in tests only.
DynamicPageCacheIntegrationTest class Drupal\Tests\dynamic_page_cache\Functional core/modules/dynamic_page_cache/tests/src/Functional/DynamicPageCacheIntegrationTest.php Enables the Dynamic Page Cache and tests it in various scenarios.
DynamicPageCacheSubscriber class Drupal\dynamic_page_cache\EventSubscriber core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php Returns cached responses as early and avoiding as much work as possible. 4 2
DynamicPageCacheTestController class Drupal\dynamic_page_cache_test core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/src/DynamicPageCacheTestController.php Controller routines for dynamic_page_cache_test routes.
EarlyDateTest class Drupal\Tests\taxonomy\Functional core/modules/taxonomy/tests/src/Functional/EarlyDateTest.php Posts an article with a taxonomy term and a date prior to 1970.
EarlyFormatSetter final class Drupal\jsonapi\Routing core/modules/jsonapi/src/Routing/EarlyFormatSetter.php Sets the 'api_json' format for requests to JSON:API resources. 2

Other projects


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