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

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
CalculatedPermissionsTrait trait Drupal\Core\Session core/lib/Drupal/Core/Session/CalculatedPermissionsTrait.php Trait for \Drupal\Core\Session\CalculatedPermissionsInterface. 2
CallableResolver class Drupal\Core\Utility core/lib/Drupal/Core/Utility/CallableResolver.php Resolves PHP callables. 18 2
CallableResolverTest class Drupal\Tests\Core\Utility core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php Tests Drupal\Core\Utility\CallableResolver.
Callback class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/Callback.php Passes the source value to a callback. 1
Callbacks class Drupal\ajax_forms_test core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php Simple object for testing methods as Ajax callbacks. 6
Callbacks class Drupal\form_test core/modules/system/tests/modules/form_test/src/Callbacks.php Simple class for testing methods as Form API callbacks. 5
Callbacks class Drupal\entity_test core/modules/system/tests/modules/entity_test/src/Callbacks.php Simple object with callbacks. 1
CallbackTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/CallbackTest.php Tests the callback process plugin.
CallsDestructableServiceController final class Drupal\destructable_test\Controller core/modules/system/tests/modules/destructable_test/src/Controller/CallsDestructableServiceController.php Controller to instantiate the destructable service.
CAlterHooks class Drupal\ccc_hook_order_test\Hook core/modules/system/tests/modules/HookOrder/ccc_hook_order_test/src/Hook/CAlterHooks.php This class contains hook implementations. 1
CanaryTransport class Drupal\mailer_transport_factory_kernel_test\Transport core/modules/mailer/tests/modules/mailer_transport_factory_kernel_test/src/Transport/CanaryTransport.php A transport only used to test the transport factory adapter. 1
CanaryTransportFactory class Drupal\mailer_transport_factory_kernel_test\Transport core/modules/mailer/tests/modules/mailer_transport_factory_kernel_test/src/Transport/CanaryTransportFactory.php A transport factory only used to test the transport factory adapter.
CancelUser class Drupal\user\Plugin\Action core/modules/user/src/Plugin/Action/CancelUser.php Cancels a user account.
CaseInsensitivePathTest class Drupal\FunctionalTests\Routing core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php Tests incoming path case insensitivity.
CaseSensitivityTest class Drupal\KernelTests\Core\Database core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php Tests handling case sensitive collation.
CastedIntFieldJoin class Drupal\views\Plugin\views\join core/modules/views/src/Plugin/views/join/CastedIntFieldJoin.php Implementation for the "casted_int_field_join" join. 1
CastedIntFieldJoinTestBase abstract class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/CastedIntFieldJoinTestBase.php Tests the "casted_int_field_join" join plugin. 3 3
CastSql class Drupal\views\Plugin\views\query core/modules/views/src/Plugin/views/query/CastSql.php Cast handling in SQL. 2
CastSqlInterface interface Drupal\views\Plugin\views\query core/modules/views/src/Plugin/views/query/CastSqlInterface.php Defines an interface for defining cast expressions in SQL. 2 1
CategorizingPluginManager class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php Class that allows testing the trait.
CategorizingPluginManagerInterface interface Drupal\Component\Plugin core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php Defines an interface for plugin managers that categorize plugin definitions. 7 7
CategorizingPluginManagerTrait trait Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php Provides a trait for the CategorizingPluginManagerInterface. 6
CategorizingPluginManagerTraitTest class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php Tests Drupal\Core\Plugin\CategorizingPluginManagerTrait.
CategoryAutocompleteController class Drupal\block\Controller core/modules/block/src/Controller/CategoryAutocompleteController.php Returns autocomplete responses for block categories. 1
CategoryAutocompleteTest class Drupal\Tests\block\Unit core/modules/block/tests/src/Unit/CategoryAutocompleteTest.php Tests Drupal\block\Controller\CategoryAutocompleteController.
ChainBreadcrumbBuilderInterface interface Drupal\Core\Breadcrumb core/lib/Drupal/Core/Breadcrumb/ChainBreadcrumbBuilderInterface.php Defines an interface a chained service that builds the breadcrumb. 1
ChainedFastBackend class Drupal\Core\Cache core/lib/Drupal/Core/Cache/ChainedFastBackend.php Defines a backend with a fast and a consistent backend chain. 3
ChainedFastBackendFactory class Drupal\Core\Cache core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php Defines the chained fast cache backend factory. 1 2
ChainedFastBackendFactoryTest class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendFactoryTest.php Tests Drupal\Core\Cache\ChainedFastBackendFactory.
ChainedFastBackendTest class Drupal\KernelTests\Core\Cache core/tests/Drupal/KernelTests/Core/Cache/ChainedFastBackendTest.php Unit test of the fast chained backend using the generic cache unit test base.
ChainedFastBackendTest class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php Tests Drupal\Core\Cache\ChainedFastBackend.
ChainedPlaceholderStrategy class Drupal\Core\Render\Placeholder core/lib/Drupal/Core/Render/Placeholder/ChainedPlaceholderStrategy.php Renders placeholders using a chain of placeholder strategies. 1 2
ChainedPlaceholderStrategyTest class Drupal\Tests\Core\Render\Placeholder core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php Tests Drupal\Core\Render\Placeholder\ChainedPlaceholderStrategy.
ChainEntityResolver class Drupal\serialization\EntityResolver core/modules/serialization/src/EntityResolver/ChainEntityResolver.php Resolver delegating the entity resolution to a chain of resolvers. 1 2
ChainEntityResolverInterface interface Drupal\serialization\EntityResolver core/modules/serialization/src/EntityResolver/ChainEntityResolverInterface.php An interface for delegating an entity resolution to a chain of resolvers. 1
ChainEntityResolverTest class Drupal\Tests\serialization\Unit\EntityResolver core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php Tests Drupal\serialization\EntityResolver\ChainEntityResolver.
ChainRequestPolicy class Drupal\Core\PageCache core/lib/Drupal/Core/PageCache/ChainRequestPolicy.php Implements a compound request policy. 2 2
ChainRequestPolicyInterface interface Drupal\Core\PageCache core/lib/Drupal/Core/PageCache/ChainRequestPolicyInterface.php Defines the interface for compound request policies. 1
ChainRequestPolicyTest class Drupal\Tests\Core\PageCache core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php Tests Drupal\Core\PageCache\ChainRequestPolicy.
ChainResponsePolicy class Drupal\Core\ProxyClass\PageCache core/lib/Drupal/Core/ProxyClass/PageCache/ChainResponsePolicy.php Provides a proxy class for \Drupal\Core\PageCache\ChainResponsePolicy.
ChainResponsePolicy class Drupal\Core\PageCache core/lib/Drupal/Core/PageCache/ChainResponsePolicy.php Implements a compound response policy. 1 4
ChainResponsePolicyInterface interface Drupal\Core\PageCache core/lib/Drupal/Core/PageCache/ChainResponsePolicyInterface.php Defines the interface for compound request policies. 2
ChainResponsePolicyTest class Drupal\Tests\Core\PageCache core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php Tests Drupal\Core\PageCache\ChainResponsePolicy.
ChangedCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/ChangedCommand.php An AJAX command for marking HTML elements as changed. 2
ChangedFieldItemList class Drupal\Core\Field core/lib/Drupal/Core/Field/ChangedFieldItemList.php Defines an item list class for changed fields. 2
ChangedItem class Drupal\Core\Field\Plugin\Field\FieldType core/lib/Drupal/Core/Field/Plugin/Field/FieldType/ChangedItem.php Defines the 'changed' entity field type. 1 2
ChangedTestItem class Drupal\entity_test\Plugin\Field\FieldType core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ChangedTestItem.php Defines the 'changed_test' entity field type.
ChangeLogger final class Drupal\package_manager\EventSubscriber core/modules/package_manager/src/EventSubscriber/ChangeLogger.php Event subscriber to log changes that happen during the stage life cycle. 1
ChangeLoggerTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ChangeLoggerTest.php Tests Change Logger.
ChangePromotedDefaultTest class Drupal\Tests\node\Functional\Update core/modules/node/tests/src/Functional/Update/ChangePromotedDefaultTest.php Tests creating base field overrides for the promote field on node types.

Other projects


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