Classes, traits, and interfaces - 10.3.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 1518

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
CoreThemesAutoloadedForTests class Drupal\Tests\Core\Theme core/tests/Drupal/Tests/Core/Theme/CoreThemesAutoloadedForTests.php Confirms that core/themes is autoloaded for tests.
Corn class Drupal\Tests\Component\Plugin\Fixtures\vegetable core/tests/Drupal/Tests/Component/Plugin/Fixtures/vegetable/Corn.php Plugin annotation @Plugin( id = "corn", label = "Corn", color = "yellow" ) 1
CorsCompilerPass class Drupal\Core\DependencyInjection\Compiler core/lib/Drupal/Core/DependencyInjection/Compiler/CorsCompilerPass.php Provides a compiler pass which disables the CORS middleware in case disabled. 1
CorsIntegrationTest class Drupal\FunctionalTests\HttpKernel core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php Tests CORS provided by Drupal.
CountableResourceType class Drupal\jsonapi_test_collection_count\ResourceType core/modules/jsonapi/tests/modules/jsonapi_test_collection_count/src/ResourceType/CountableResourceType.php Subclass with overridden ::includeCount() for testing purposes.
CountableResourceTypeRepository class Drupal\jsonapi_test_collection_count\ResourceType core/modules/jsonapi/tests/modules/jsonapi_test_collection_count/src/ResourceType/CountableResourceTypeRepository.php Provides a repository of JSON:API configurable resource types. 2
CountConstraint class Drupal\Core\Validation\Plugin\Validation\Constraint core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/CountConstraint.php Count constraint.
Counter class Drupal\views\Plugin\views\field core/modules/views/src/Plugin/views/field/Counter.php Field handler to show a counter of the current row. 1
CounterTest class Drupal\Tests\views\Unit\Plugin\field core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php @coversDefaultClass \Drupal\views\Plugin\views\field\Counter @group views
CountryCodeConstraint class Drupal\Core\Validation\Plugin\Validation\Constraint core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/CountryCodeConstraint.php 1
CountryCodeConstraintTest class Drupal\Tests\Core\Validation\Plugin\Validation\Constraint core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/CountryCodeConstraintTest.php @covers \Drupal\Core\Validation\Plugin\Validation\Constraint\CountryCodeConstraint @group validation
CountryManager class Drupal\Core\Locale core/lib/Drupal/Core/Locale/CountryManager.php Provides list of countries. 2
CountryManagerInterface interface Drupal\Core\Locale core/lib/Drupal/Core/Locale/CountryManagerInterface.php Defines a common interface for country managers. 1 4
CountryManagerTest class Drupal\KernelTests\Core\Locale core/tests/Drupal/KernelTests/Core/Locale/CountryManagerTest.php Tests Country Manager functionality.
CreatedItem class Drupal\Core\Field\Plugin\Field\FieldType core/lib/Drupal/Core/Field/Plugin/Field/FieldType/CreatedItem.php Defines the 'created' entity field type. 1 2
CreateMigrationsTrait trait Drupal\Tests\migrate_drupal\Traits core/modules/migrate_drupal/tests/src/Traits/CreateMigrationsTrait.php 1
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
CredentialFormTest class Drupal\Tests\migrate_drupal_ui\Functional core/modules/migrate_drupal_ui/tests/src/Functional/CredentialFormTest.php Test the credential form for both Drupal 6 and Drupal 7 sources.
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 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
CronLoggingUpdateTest class Drupal\Tests\system\Functional\Update core/modules/system/tests/src/Functional/Update/CronLoggingUpdateTest.php Tests update of system.cron:logging.
CronQueueTest class Drupal\Tests\system\Kernel\System core/modules/system/tests/src/Kernel/System/CronQueueTest.php Tests the Cron Queue runner.
CronQueueTestDatabaseDelayException class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestDatabaseDelayException.php A queue worker for testing cron exception handling. 1
CronQueueTestDeriver class Drupal\cron_queue_test\Plugin\Derivative core/modules/system/tests/modules/cron_queue_test/src/Plugin/Derivative/CronQueueTestDeriver.php Provides a deriver for testing cron queues. 1
CronQueueTestDeriverQueue class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestDeriverQueue.php A queue worker for testing derivatives. 1
CronQueueTestException class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestException.php A queue worker for testing exceptions. 1
CronQueueTestLeaseTime class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestLeaseTime.php A queue worker for testing lease time.
CronQueueTestMemoryDelayException class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestMemoryDelayException.php A queue worker for testing cron exception handling.
CronQueueTestRequeueException class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestRequeueException.php A queue worker for testing re-queueing items. 1
CronQueueTestSuspendQueue class Drupal\cron_queue_test\Plugin\QueueWorker core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestSuspendQueue.php A queue worker for testing suspending queue run. 1
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. 16
CronSuspendQueueDelayTest final class Drupal\Tests\Core\Cron core/tests/Drupal/Tests/Core/Cron/CronSuspendQueueDelayTest.php Test Cron handling of suspended queues with a delay.
CronTest class Drupal\Tests\Core core/tests/Drupal/Tests/Core/CronTest.php Tests the Cron class.
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
Crypt class Drupal\Component\Utility core/lib/Drupal/Component/Utility/Crypt.php Utility class for cryptographically-secure string handling routines. 87
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
CsrfExceptionSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/CsrfExceptionSubscriber.php Handles exceptions related to CSRF 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.

Other projects


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