Classes, traits, and interfaces - 9.5.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 1523

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
CrudTest class Drupal\Tests\rdf\Kernel core/modules/rdf/tests/src/Kernel/CrudTest.php Tests the RDF mapping CRUD functions.
Crypt class Drupal\Component\Utility core/lib/Drupal/Component/Utility/Crypt.php Utility class for cryptographically-secure string handling routines. 84
CryptTest class Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/CryptTest.php Tests random byte generation.
CsrfAccessCheck class Drupal\Core\Access core/lib/Drupal/Core/Access/CsrfAccessCheck.php Access protection against CSRF attacks. 1 2
CsrfAccessCheckTest class Drupal\Tests\Core\Access core/tests/Drupal/Tests/Core/Access/CsrfAccessCheckTest.php @coversDefaultClass \Drupal\Core\Access\CsrfAccessCheck @group Access
CsrfRequestHeaderAccessCheck class Drupal\Core\Access core/lib/Drupal/Core/Access/CsrfRequestHeaderAccessCheck.php Access protection against CSRF attacks. 1 2
CsrfRequestHeaderTest class Drupal\Tests\system\Functional core/modules/system/tests/src/Functional/CsrfRequestHeaderTest.php Tests protecting routes by requiring CSRF token in the request header.
CsrfTokenController class Drupal\system\Controller core/modules/system/src/Controller/CsrfTokenController.php Returns responses for CSRF token routes.
CsrfTokenGenerator class Drupal\Core\Access core/lib/Drupal/Core/Access/CsrfTokenGenerator.php Generates and validates CSRF tokens. 15 2
CsrfTokenGeneratorTest class Drupal\Tests\Core\Access core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php Tests the CsrfTokenGenerator class.
CsrfTokenRaceTest class Drupal\FunctionalJavascriptTests\Core core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php Test race condition for CSRF tokens for simultaneous requests.
CssCollectionGrouper class Drupal\Core\Asset core/lib/Drupal/Core/Asset/CssCollectionGrouper.php Groups CSS assets. 1 2
CssCollectionGrouperUnitTest class Drupal\Tests\Core\Asset core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php Tests the CSS asset collection grouper.
CssCollectionOptimizer class Drupal\Core\Asset core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php Optimizes CSS assets. 1 2
CssCollectionOptimizerUnitTest class Drupal\Tests\Core\Asset core/tests/Drupal/Tests/Core/Asset/CssCollectionOptimizerUnitTest.php Tests the CSS asset optimizer.
CssCollectionRenderer class Drupal\Core\Asset core/lib/Drupal/Core/Asset/CssCollectionRenderer.php Renders CSS assets. 1 2
CssCollectionRendererUnitTest class Drupal\Tests\Core\Asset core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php Tests the CSS asset collection renderer.
CssCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/CssCommand.php An AJAX command for calling the jQuery css() method. 2
CssOptimizer class Drupal\Core\Asset core/lib/Drupal/Core/Asset/CssOptimizer.php Optimizes a CSS asset. 2 2
CssOptimizerUnitTest class Drupal\Tests\Core\Asset core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php Tests the CSS asset optimizer.
Current class Drupal\user\Plugin\views\filter core/modules/user/src/Plugin/views/filter/Current.php Filter handler for the current user.
CurrentLanguageContext class Drupal\Core\Language\ContextProvider core/lib/Drupal/Core/Language/ContextProvider/CurrentLanguageContext.php Sets the current language as a context. 2
CurrentPathStack class Drupal\Core\Path core/lib/Drupal/Core/Path/CurrentPathStack.php Represents the current path for the current request. 20 2
CurrentRouteMatch class Drupal\Core\Routing core/lib/Drupal/Core/Routing/CurrentRouteMatch.php Default object for current_route_match service. 3 2
CurrentRouteMatchTest class Drupal\Tests\Core\Routing core/tests/Drupal/Tests/Core/Routing/CurrentRouteMatchTest.php @coversDefaultClass \Drupal\Core\Routing\CurrentRouteMatch @group Routing
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. 2
CurrentUserContextTest class Drupal\Tests\user\Kernel\ContextProvider core/modules/user/tests/src/Kernel/ContextProvider/CurrentUserContextTest.php @coversDefaultClass \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 @coversDefaultClass \Drupal\Core\Access\CustomAccessCheck @group Access
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.
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 @coversDefaultClass \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber @group EventSubscriber
CustomPlugin class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php Custom plugin annotation.
CustomPlugin2 class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php Custom plugin annotation.
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 Plugin annotation @MigrateField( id = "d6_file", core = {6}, type_map = { "file" = "file" }, source_module = "foo", destination_module = "bar" )
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 Plugin annotation @MigrateField( id = "d6_no_core_version_specified", source_module = "foo", destination_module = "bar", )
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

Other projects


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