Classes, traits, and interfaces - main - 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 1529

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
ComposerInstallersTrait trait Drupal\Tests\package_manager\Traits core/modules/package_manager/tests/src/Traits/ComposerInstallersTrait.php A utility for kernel tests that need to use 'composer/installers'. 3
ComposerIntegrationTest class Drupal\Tests core/tests/Drupal/Tests/ComposerIntegrationTest.php Tests Composer integration.
ComposerIntegrationTrait trait Drupal\Tests\Composer core/tests/Drupal/Tests/Composer/ComposerIntegrationTrait.php Some utility functions for testing the Composer integration. 2
ComposerMinimumStabilityValidator final class Drupal\package_manager\Validator core/modules/package_manager/src/Validator/ComposerMinimumStabilityValidator.php Checks that the packages to install meet the minimum stability. 1
ComposerMinimumStabilityValidatorTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ComposerMinimumStabilityValidatorTest.php Tests Composer Minimum Stability Validator.
ComposerNotReadyException final class Drupal\package_manager\Exception core/modules/package_manager/src/Exception/ComposerNotReadyException.php Exception thrown if we cannot reliably use Composer. 2
ComposerPatches class cweagans\Fake core/modules/package_manager/tests/fixtures/path_repos/cweagans--composer-patches/src/ComposerPatches.php Dummy composer plugin implementation.
ComposerPatchesValidator final class Drupal\package_manager\Validator core/modules/package_manager/src/Validator/ComposerPatchesValidator.php Validates the configuration of the cweagans/composer-patches plugin. 1
ComposerPatchesValidatorTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ComposerPatchesValidatorTest.php Tests Composer Patches Validator.
ComposerPluginImplementsScaffoldEvents class Drupal\Tests\fixture\Composer\Plugin core/tests/Drupal/Tests/Composer/Plugin/Scaffold/fixtures/composer-plugin-implements-scaffold-events/src/ComposerPluginImplementsScaffoldEvents.php A fixture composer plugin implement Drupal scaffold events.
ComposerPluginsValidator final class Drupal\package_manager\Validator core/modules/package_manager/src/Validator/ComposerPluginsValidator.php Validates the allowed Composer plugins, both in active and stage. 4
ComposerPluginsValidatorComplexInvalidTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorComplexInvalidTest.php Tests Composer Plugins Validator Complex Invalid.
ComposerPluginsValidatorInsecureTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorInsecureTest.php Tests Composer Plugins Validator Insecure.
ComposerPluginsValidatorSimpleInvalidTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorSimpleInvalidTest.php Tests Composer Plugins Validator Simple Invalid.
ComposerPluginsValidatorSimpleValidTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorSimpleValidTest.php Tests Composer Plugins Validator Simple Valid.
ComposerPluginsValidatorTestBase abstract class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorTestBase.php @internal 3
ComposerProjectTemplatesTest class Drupal\BuildTests\Composer\Template core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php Demonstrate that Composer project templates can be built as patched.
ComposerRequirementTest class Drupal\Tests\package_manager\Functional core/modules/package_manager/tests/src/Functional/ComposerRequirementTest.php Tests that Package Manager shows the Composer version on the status report.
ComposerRunner final class Drupal\package_manager core/modules/package_manager/src/ComposerRunner.php Runs Composer through the current PHP interpreter. 1 2
ComposerRunnerTest class Drupal\Tests\package_manager\Unit core/modules/package_manager/tests/src/Unit/ComposerRunnerTest.php Tests Package Manager's Composer runner service.
ComposerScaffoldCommand class Drupal\Composer\Plugin\Scaffold composer/Plugin/Scaffold/ComposerScaffoldCommand.php The "drupal:scaffold" command class.
ComposerStagerExceptionTrait trait Drupal\package_manager_bypass core/modules/package_manager/tests/modules/package_manager_bypass/src/ComposerStagerExceptionTrait.php Trait to make Composer Stager throw pre-determined exceptions in tests.
ComposerStagerTestTrait trait Drupal\Tests\package_manager\Traits core/modules/package_manager/tests/src/Traits/ComposerStagerTestTrait.php Contains helper methods for testing Composer Stager interactions. 1
ComposerTest class Drupal\Tests\Composer core/tests/Drupal/Tests/Composer/ComposerTest.php Tests Drupal\Composer\Composer.
ComposerValidateTest class Drupal\BuildTests\Composer core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php Tests.
ComposerValidator final class Drupal\package_manager\Validator core/modules/package_manager/src/Validator/ComposerValidator.php Validates the project can be used by the Composer Inspector. 1
ComposerValidatorTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ComposerValidatorTest.php Tests Composer Validator.
CompositeConstraintBase abstract class Drupal\Core\Entity\Plugin\Validation\Constraint core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/CompositeConstraintBase.php Provides a base class for constraints validating multiple fields. 4 6
CompositeConstraintInterface interface Drupal\Core\Validation core/lib/Drupal/Core/Validation/CompositeConstraintInterface.php An interface to provide a bridge to Symfony composite constraints. 5 5
CompositeFormElementTrait trait Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/CompositeFormElementTrait.php Provides a trait for radios, checkboxes, and similar composite form elements.
ComputedBundleFieldTest class Drupal\Tests\views\Kernel\Handler core/modules/views/tests/src/Kernel/Handler/ComputedBundleFieldTest.php Provides some integration tests for computed bundle fields.
ComputedFieldTest class Drupal\Tests\views\Kernel\Handler core/modules/views/tests/src/Kernel/Handler/ComputedFieldTest.php Provides some integration tests for the Field handler.
ComputedFileUrl class Drupal\file core/modules/file/src/ComputedFileUrl.php Computed file URL property class. 2
ComputedFileUrlTest class Drupal\Tests\file\Kernel core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php Tests Drupal\file\ComputedFileUrl.
ComputedItemListTrait trait Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php Provides common functionality for computed item lists. 7
ComputedReferenceTestFieldItemList class Drupal\entity_test\Plugin\Field core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedReferenceTestFieldItemList.php A computed entity reference field item list. 2
ComputedString class Drupal\entity_test\TypedData core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php A computed property for test strings. 2
ComputedTestBundleFieldItemList class Drupal\entity_test\Plugin\Field core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedTestBundleFieldItemList.php A computed field item list for a bundle field. 1
ComputedTestCacheableIntegerItemList class Drupal\entity_test\Plugin\Field core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedTestCacheableIntegerItemList.php Item list class for computed cacheable string field. 1
ComputedTestCacheableString class Drupal\entity_test\Plugin\DataType core/modules/system/tests/modules/entity_test/src/Plugin/DataType/ComputedTestCacheableString.php The string data type with cacheability metadata.
ComputedTestCacheableStringItem class Drupal\entity_test\Plugin\Field\FieldType core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ComputedTestCacheableStringItem.php Defines the 'string' entity field type with cacheability metadata.
ComputedTestCacheableStringItemList class Drupal\entity_test\Plugin\Field core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedTestCacheableStringItemList.php Item list class for computed cacheable string field. 2
ComputedTestFieldItemList class Drupal\entity_test\Plugin\Field core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedTestFieldItemList.php A computed field item list. 2
Concat class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/Concat.php Concatenates a set of strings. 1 2
ConcatTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/ConcatTest.php Tests the concat process plugin.
ConcreteWithAnnotationTest class Drupal\Tests\Core\Foo core/tests/PHPStan/fixtures/test-classes-with-metadata.php @group metadata
ConcreteWithAttributeTest class Drupal\Tests\Core\Foo core/tests/PHPStan/fixtures/test-classes-with-metadata.php #[Group('Test')]
Condition class Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/Condition.php CoreFakeWithAllCustomClasses implementation of \Drupal\Core\Database\Condition.
Condition class Drupal\pgsql\EntityQuery core/modules/pgsql/src/EntityQuery/Condition.php Implements entity query conditions for PostgreSQL databases.
Condition class Drupal\Core\Database\Query core/lib/Drupal/Core/Database/Query/Condition.php Generic class for a series of conditions in a query. 2 6

Other projects


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