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
ComposerIntegrationTrait trait Drupal\Tests\Composer core/tests/Drupal/Tests/Composer/ComposerIntegrationTrait.php Some utility functions for testing the Composer integration. 2
ComposerProjectTemplatesTest class Drupal\BuildTests\Composer\Template core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php Demonstrate that Composer project templates are buildable as patched.
ComposerScaffoldCommand class Drupal\Composer\Plugin\Scaffold composer/Plugin/Scaffold/ComposerScaffoldCommand.php The "drupal:scaffold" command class.
ComposerTest class Drupal\Tests\Composer core/tests/Drupal/Tests/Composer/ComposerTest.php @coversDefaultClass \Drupal\Composer\Composer @group Composer
ComposerValidateTest class Drupal\BuildTests\Composer core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php @group Composer @requires externalCommand composer
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
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.
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 @coversDefaultClass \Drupal\file\ComputedFileUrl
ComputedItemListTrait trait Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php Provides common functionality for computed item lists. 4
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. 1
ComputedString class Drupal\entity_test\TypedData core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php A computed property for test strings. 1
ComputedTestFieldItemList class Drupal\entity_test\Plugin\Field core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedTestFieldItemList.php A computed field item list. 1
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.
Condition class Drupal\Core\Database\Query core/lib/Drupal/Core/Database/Query/Condition.php Generic class for a series of conditions in a query. 35
Condition class Drupal\Core\Entity\Query\Sql core/lib/Drupal/Core/Entity/Query/Sql/Condition.php Implements entity query conditions for SQL databases. 1 1
Condition class Drupal\Core\Entity\Query\Sql\pgsql core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php Implements entity query conditions for PostgreSQL databases.
Condition class Drupal\Core\Entity\Query\Null core/lib/Drupal/Core/Entity/Query/Null/Condition.php Defines the condition class for the null entity query.
Condition class Drupal\Core\Entity\KeyValueStore\Query core/lib/Drupal/Core/Entity/KeyValueStore/Query/Condition.php Defines the condition class for the key value entity query.
Condition class Drupal\Core\Condition\Annotation core/lib/Drupal/Core/Condition/Annotation/Condition.php Defines a condition plugin annotation object.
Condition class Drupal\Core\Config\Entity\Query core/lib/Drupal/Core/Config/Entity/Query/Condition.php Defines the condition class for the config entity query. 1 1
ConditionAccessResolverTrait trait Drupal\Core\Condition core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php Resolves a set of conditions. 1
ConditionAccessResolverTraitTest class Drupal\Tests\Core\Condition core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php @coversDefaultClass \Drupal\Core\Condition\ConditionAccessResolverTrait @group Condition
ConditionAggregate class Drupal\Core\Entity\Query\Sql core/lib/Drupal/Core/Entity/Query/Sql/ConditionAggregate.php Defines the aggregate condition for sql based storage. 1
ConditionAggregateBase abstract class Drupal\Core\Entity\Query core/lib/Drupal/Core/Entity/Query/ConditionAggregateBase.php Defines a common base class for all aggregation entity condition implementations. 1 1
ConditionAggregateInterface interface Drupal\Core\Entity\Query core/lib/Drupal/Core/Entity/Query/ConditionAggregateInterface.php Defines aggregated entity query conditions. 1 1
ConditionBase abstract class Drupal\Core\Entity\Query core/lib/Drupal/Core/Entity/Query/ConditionBase.php Defines a common base class for all entity condition implementations. 3 3
ConditionFormTest class Drupal\Tests\system\Functional\Condition core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php Tests that condition plugins basic form handling is working.
ConditionFundamentals abstract class Drupal\Core\Entity\Query core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php Common code for all implementations of the entity query condition interfaces. 2
ConditionInterface interface Drupal\Core\Database\Query core/lib/Drupal/Core/Database/Query/ConditionInterface.php Interface for a conditional clause in a query. 5 2
ConditionInterface interface Drupal\Core\Entity\Query core/lib/Drupal/Core/Entity/Query/ConditionInterface.php Defines the entity query condition interface. 1 2
ConditionInterface interface Drupal\Core\Condition core/lib/Drupal/Core/Condition/ConditionInterface.php An interface for condition plugins. 1
ConditionManager class Drupal\Core\Condition core/lib/Drupal/Core/Condition/ConditionManager.php A plugin manager for condition plugins. 1 2
ConditionPluginBase abstract class Drupal\Core\Condition core/lib/Drupal/Core/Condition/ConditionPluginBase.php Provides a basis for fulfilling contexts for condition plugins. 10 10
ConditionPluginCollection class Drupal\Core\Condition core/lib/Drupal/Core/Condition/ConditionPluginCollection.php Provides a collection of condition plugins. 1
ConditionTest class Drupal\Tests\Core\Database core/tests/Drupal/Tests/Core/Database/ConditionTest.php @coversDefaultClass \Drupal\Core\Database\Query\Condition
ConditionTestDualUser class Drupal\condition_test\Plugin\Condition core/modules/system/tests/modules/condition_test/src/Plugin/Condition/ConditionTestDualUser.php Provides a condition that requires two users.
ConditionTestDualUserTest class Drupal\KernelTests\Core\Plugin\Condition core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php Tests a condition that requires two users.
ConditionTestNoExistingType class Drupal\condition_test\Plugin\Condition core/modules/system/tests/modules/condition_test/src/Plugin/Condition/ConditionTestNoExistingType.php Provides a condition that has a no existing context.
Config class Drupal\migrate\Plugin\migrate\destination core/modules/migrate/src/Plugin/migrate/destination/Config.php Provides Configuration Management destination plugin. 1 4
Config class Drupal\Core\Config core/lib/Drupal/Core/Config/Config.php Defines the default configuration object. 1 26
Config class Drupal\Composer\Plugin\VendorHardening composer/Plugin/VendorHardening/Config.php Determine configuration. 2
Config class Drupal\migrate_drupal\Plugin\migrate\source\d8 core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php Drupal config source from database.
ConfigAccessTest class Drupal\Tests\settings_tray\FunctionalJavascript core/modules/settings_tray/tests/src/FunctionalJavascript/ConfigAccessTest.php Tests handling of configuration overrides.
ConfigAfterInstallerTestBase

in drupal:8.6.0 and is removed from drupal:9.0.0. Use \Drupal\FunctionalTests\Installer\ConfigAfterInstallerTestBase.

abstract class Drupal\system\Tests\Installer core/modules/system/src/Tests/Installer/ConfigAfterInstallerTestBase.php Provides a class for install profiles to check their installed config.
ConfigAfterInstallerTestBase abstract class Drupal\FunctionalTests\Installer core/tests/Drupal/FunctionalTests/Installer/ConfigAfterInstallerTestBase.php Provides a class for install profiles to check their installed config. 2
ConfigBase abstract class Drupal\Core\Config core/lib/Drupal/Core/Config/ConfigBase.php Provides a base class for configuration objects with get/set support. 2 2
ConfigCacheTag class Drupal\system\EventSubscriber core/modules/system/src/EventSubscriber/ConfigCacheTag.php A subscriber invalidating cache tags when system config objects are saved. 2

Other projects


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