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
CreateNew class Drupal\system\Plugin\ImageToolkit\Operation\gd core/modules/system/src/Plugin/ImageToolkit/Operation/gd/CreateNew.php Defines GD2 create_new image operation.
CreateSampleEntityTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php Tests the ContentEntityStorageBase::createWithSampleValues method.
CreateTestContentEntitiesTrait trait Drupal\Tests\migrate_drupal\Traits core/modules/migrate_drupal/tests/src/Traits/CreateTestContentEntitiesTrait.php Provides helper methods for creating test content. 8
CredentialForm class Drupal\migrate_drupal_ui\Form core/modules/migrate_drupal_ui/src/Form/CredentialForm.php Migrate Upgrade database credential form. 1
Cron class Drupal\Core\ProxyClass core/lib/Drupal/Core/ProxyClass/Cron.php Provides a proxy class for \Drupal\Core\Cron.
Cron class Drupal\Core core/lib/Drupal/Core/Cron.php The Drupal core Cron service. 2
CronAccessCheck class Drupal\system\Access core/modules/system/src/Access/CronAccessCheck.php Access check for cron routes. 2
CronController class Drupal\system core/modules/system/src/CronController.php Controller for Cron handling.
CronForm class Drupal\system\Form core/modules/system/src/Form/CronForm.php Configure cron settings for this site. 1
CronInterface interface Drupal\Core core/lib/Drupal/Core/CronInterface.php An interface for running cron tasks. 2 3
CronQueueTest class Drupal\Tests\system\Kernel\System core/modules/system/tests/src/Kernel/System/CronQueueTest.php Tests the Cron Queue runner.
CronQueueTestBrokenQueue class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestBrokenQueue.php Plugin annotation @QueueWorker( id = "cron_queue_test_broken_queue", title = @Translation("Broken queue test"), cron = {"time" = 60} )
CronQueueTestException class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestException.php Plugin annotation @QueueWorker( id = "cron_queue_test_exception", title = @Translation("Exception test"), cron = {"time" = 1} )
CronQueueTestRequeueException class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestRequeueException.php Plugin annotation @QueueWorker( id = "cron_queue_test_requeue_exception", title = @Translation("RequeueException test"), cron = {"time" = 60} )
CronRunTest class Drupal\Tests\system\Functional\System core/modules/system/tests/src/Functional/System/CronRunTest.php Tests cron runs.
CronRunTrait trait Drupal\Tests\Traits\Core core/tests/Drupal/Tests/Traits/Core/CronRunTrait.php Adds ability to run cron from tests. 17
Crop class Drupal\system\Plugin\ImageToolkit\Operation\gd core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Crop.php Defines GD2 Crop operation.
CropImageEffect class Drupal\image\Plugin\ImageEffect core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php Crops an image resource. 1
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. 83
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 Allows access to routes to be controlled by a '_csrf_token' parameter. 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. 14 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. 2
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

Other projects


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