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 1531

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
CurrentThemeCondition class Drupal\system\Plugin\Condition core/modules/system/src/Plugin/Condition/CurrentThemeCondition.php Provides a 'Current Theme' condition.
CurrentThemeConditionTest class Drupal\KernelTests\Core\Plugin\Condition core/tests/Drupal/KernelTests/Core/Plugin/Condition/CurrentThemeConditionTest.php Tests the CurrentThemeCondition plugin.
CurrentUser class Drupal\user\Plugin\views\argument_default core/modules/user/src/Plugin/views/argument_default/CurrentUser.php Default argument plugin to extract the current user.
CurrentUserContext class Drupal\user\ContextProvider core/modules/user/src/ContextProvider/CurrentUserContext.php Sets the current user as a context. 1 2
CurrentUserContextTest class Drupal\Tests\user\Kernel\ContextProvider core/modules/user/tests/src/Kernel/ContextProvider/CurrentUserContextTest.php Tests Drupal\user\ContextProvider\CurrentUserContext.
Custom class Drupal\views\Plugin\views\field core/modules/views/src/Plugin/views/field/Custom.php A handler to provide a field that is completely custom by the administrator.
CustomAccessCheck class Drupal\Core\Access core/lib/Drupal/Core/Access/CustomAccessCheck.php Defines an access checker that allows specifying a custom method for access. 1 2
CustomAccessCheckTest class Drupal\Tests\Core\Access core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php Tests Drupal\Core\Access\CustomAccessCheck.
CustomAnnotationClassDiscoveryTest class Drupal\KernelTests\Core\Plugin\Discovery core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php Tests that a custom annotation class is used.
CustomBooleanTest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php Tests the UI and functionality for the Custom boolean field handler options.
CustomDirectoryAnnotatedClassDiscoveryTest class Drupal\KernelTests\Core\Plugin\Discovery core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php Tests discovery of annotated plugins in a custom directory.
CustomDirectoryExample1 class Drupal\plugin_test core/modules/system/tests/modules/plugin_test/src/CustomDirectoryExample1.php Provides a test plugin within a custom directory.
CustomDirectoryExample2 class Drupal\plugin_test core/modules/system/tests/modules/plugin_test/src/CustomDirectoryExample2.php Provides a test plugin within a custom directory.
CustomFileCache class Drupal\Tests\Component\FileCache core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php Class to help test the file cache class.
CustomPageExceptionHtmlSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php Exception subscriber for handling core custom HTML error pages. 1 2
CustomPageExceptionHtmlSubscriberTest class Drupal\Tests\Core\EventSubscriber core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php Tests Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber.
CustomPlugin class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php Custom plugin annotation.
CustomPlugin class com\example\PluginNamespace core/tests/fixtures/plugins/CustomPlugin.php Custom plugin attribute.
CustomPlugin2 class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php Custom plugin annotation.
CustomPlugin2 class com\example\PluginNamespace core/tests/fixtures/plugins/CustomPlugin.php Custom plugin attribute.
CustomStrings class Drupal\Core\StringTranslation\Translator core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php String translator using overrides from variables. 2
CustomThemeNegotiator class Drupal\theme_test\Theme core/modules/system/tests/modules/theme_test/src/Theme/CustomThemeNegotiator.php Just forces the 'test_theme' theme. 2
D6FileField class Drupal\migrate_field_plugin_manager_test\Plugin\migrate\field core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6FileField.php MigrateField Plugin for Drupal 6 file fields.
D6NoCoreVersionSpecified class Drupal\migrate_field_plugin_manager_test\Plugin\migrate\field core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6NoCoreVersionSpecified.php MigrateField Plugin for migrating fields without core version specification.
D6NodeDeriver class Drupal\node\Plugin\migrate core/modules/node/src/Plugin/migrate/D6NodeDeriver.php Deriver for Drupal 6 node and node revision migrations based on node types. 4
D6NodeTranslation class Drupal\node\Plugin\migrate core/modules/node/src/Plugin/migrate/D6NodeTranslation.php Migration plugin for the Drupal 6 node translations. 2
D6TermNodeDeriver class Drupal\taxonomy\Plugin\migrate core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php Deriver for Drupal 6 term node migrations based on vocabularies. 3
D7Comment class Drupal\comment\Plugin\migrate core/modules/comment/src/Plugin/migrate/D7Comment.php Migration plugin for Drupal 7 comments with fields. 2
D7NodeDeriver class Drupal\node\Plugin\migrate core/modules/node/src/Plugin/migrate/D7NodeDeriver.php Deriver for Drupal 7 node and node revision migrations based on node types. 5
D7NodeTranslation class Drupal\node\Plugin\migrate core/modules/node/src/Plugin/migrate/D7NodeTranslation.php Migration plugin for the Drupal 7 node translations. 2
D7TaxonomyTermDeriver class Drupal\taxonomy\Plugin\migrate core/modules/taxonomy/src/Plugin/migrate/D7TaxonomyTermDeriver.php Deriver for Drupal 7 taxonomy term migrations based on vocabularies. 2
DAlterHooks class Drupal\ddd_hook_order_test\Hook core/modules/system/tests/modules/HookOrder/ddd_hook_order_test/src/Hook/DAlterHooks.php This class contains hook implementations. 1
Data abstract class Drupal\jsonapi\JsonApiResource core/modules/jsonapi/src/JsonApiResource/Data.php Represents the `data` and `included` objects of a top-level object. 2 5
Database abstract class Drupal\Core\Database core/lib/Drupal/Core/Database/Database.php Primary front-controller for the database system. 245
DatabaseAccessDeniedException class Drupal\Core\Database core/lib/Drupal/Core/Database/DatabaseAccessDeniedException.php Exception thrown if access credentials fail. 3
DatabaseBackend class Drupal\Core\Flood core/lib/Drupal/Core/Flood/DatabaseBackend.php Defines the database flood backend. This is the default Drupal backend. 2 2
DatabaseBackend class Drupal\Core\Cache core/lib/Drupal/Core/Cache/DatabaseBackend.php Defines a default cache implementation. 4
DatabaseBackendFactory class Drupal\Core\Cache core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php Defines a default cache backend factory. 2 2
DatabaseBackendFactoryTest class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/DatabaseBackendFactoryTest.php Tests Drupal\Core\Cache\DatabaseBackendFactory.
DatabaseBackendTagTest class Drupal\KernelTests\Core\Cache core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTagTest.php Tests DatabaseBackend cache tag implementation.
DatabaseBackendTest class Drupal\KernelTests\Core\Cache core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php Unit test of the database backend using the generic cache unit test base.
DatabaseCacheTagsChecksum class Drupal\Core\Cache core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php Cache tags invalidations checksum implementation that uses the database. 2
DatabaseConnectionRefusedException class Drupal\Core\Database core/lib/Drupal/Core/Database/DatabaseConnectionRefusedException.php Exception thrown if server refuses connection. 2
DatabaseDriver class Drupal\Core\Extension core/lib/Drupal/Core/Extension/DatabaseDriver.php Defines a database driver extension object.
DatabaseDriverList class Drupal\Core\Extension core/lib/Drupal/Core/Extension/DatabaseDriverList.php Provides a list of available database drivers. 4 2
DatabaseDriverListTest class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/DatabaseDriverListTest.php Tests DatabaseDriverList methods.
DatabaseDriverProvidedByModuleTest class Drupal\Tests\system\Functional\System core/modules/system/tests/src/Functional/System/DatabaseDriverProvidedByModuleTest.php Tests output on the status overview page.
DatabaseDriverUninstallValidator class Drupal\Core\Extension core/lib/Drupal/Core/Extension/DatabaseDriverUninstallValidator.php Ensures installed modules providing a database driver are not uninstalled. 2
DatabaseEvent abstract class Drupal\Core\Database\Event core/lib/Drupal/Core/Database/Event/DatabaseEvent.php Represents a database event. 2 4
DatabaseEventEnabler class Drupal\performance_test core/modules/system/tests/modules/performance_test/src/DatabaseEventEnabler.php Enables database event logging for the main request.

Other projects


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