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 1519

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
CommentViewsHooks class Drupal\comment\Hook core/modules/comment/src/Hook/CommentViewsHooks.php Hook implementations for comment.
CommentViewsKernelTestBase abstract class Drupal\Tests\comment\Kernel\Views core/modules/comment/tests/src/Kernel/Views/CommentViewsKernelTestBase.php Provides a common test base for comment views tests. 2
CommentWidget class Drupal\comment\Plugin\Field\FieldWidget core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php Provides a default comment widget.
CommentXmlAnonTest class Drupal\Tests\comment\Functional\Rest core/modules/comment/tests/src/Functional/Rest/CommentXmlAnonTest.php @group rest
CommentXmlBasicAuthTest class Drupal\Tests\comment\Functional\Rest core/modules/comment/tests/src/Functional/Rest/CommentXmlBasicAuthTest.php @group rest
CommentXmlCookieTest class Drupal\Tests\comment\Functional\Rest core/modules/comment/tests/src/Functional/Rest/CommentXmlCookieTest.php @group rest
CommonCollectionFilterAccessTestPatternsTrait trait Drupal\Tests\jsonapi\Traits core/modules/jsonapi/tests/src/Traits/CommonCollectionFilterAccessTestPatternsTrait.php Provides common filter access control tests. 8
CommonTestController class Drupal\common_test\Controller core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php Controller routines for common_test routes.
CommonTestCronHelperHooks class Drupal\common_test_cron_helper\Hook core/modules/system/tests/modules/common_test_cron_helper/src/Hook/CommonTestCronHelperHooks.php Hook implementations for common_test_cron_helper.
CommonTestHooks class Drupal\common_test\Hook core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php Hook implementations for common_test.
CompiledRoute class Drupal\Core\Routing core/lib/Drupal/Core/Routing/CompiledRoute.php A compiled route contains derived information from a route object.
ComplexDataConstraint class Drupal\Core\Validation\Plugin\Validation\Constraint core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraint.php Complex data constraint.
ComplexDataConstraintValidator class Drupal\Core\Validation\Plugin\Validation\Constraint core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraintValidator.php Validates complex data.
ComplexDataConstraintValidatorTest class Drupal\KernelTests\Core\TypedData core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php Tests ComplexData validation with both valid and invalid values.
ComplexDataDefinitionBase abstract class Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/ComplexDataDefinitionBase.php Base class for complex data definitions. 2 1
ComplexDataDefinitionInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/ComplexDataDefinitionInterface.php Interface for complex data definitions. 3 8
ComplexDataInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/ComplexDataInterface.php Interface for complex data; i.e. data containing named and typed properties. 4 15
ComplexDataNormalizer class Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/ComplexDataNormalizer.php Converts the Drupal entity object structures to a normalized array. 3 1 2
ComplexDataNormalizerTest class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/ComplexDataNormalizerTest.php @coversDefaultClass \Drupal\serialization\Normalizer\ComplexDataNormalizer @group serialization
ComplexTestType class Drupal\workflow_type_test\Plugin\WorkflowType core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/ComplexTestType.php Test workflow type.
ComplexTestTypeConfigureForm class Drupal\workflow_type_test\Form core/modules/workflows/tests/modules/workflow_type_test/src/Form/ComplexTestTypeConfigureForm.php Form to configure the complex test workflow type.
ComplexTestTypeStateForm class Drupal\workflow_type_test\Form core/modules/workflows/tests/modules/workflow_type_test/src/Form/ComplexTestTypeStateForm.php Form to configure the complex test workflow states.
ComplexTestTypeTransitionForm class Drupal\workflow_type_test\Form core/modules/workflows/tests/modules/workflow_type_test/src/Form/ComplexTestTypeTransitionForm.php Form to configure the complex test workflow states.
ComplexWorkflowTypeTest class Drupal\Tests\workflows\Kernel core/modules/workflows/tests/src/Kernel/ComplexWorkflowTypeTest.php Workflow entity tests that require modules or storage.
Component class Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/Component.php Simple value object that contains information about the component. 6
Component final class Drupal\sdc\Plugin core/modules/sdc/src/Plugin/Component.php Simple value object that contains information about the component. 6
ComponentElement class Drupal\sdc\Element core/modules/sdc/src/Element/ComponentElement.php Provides a Single Directory Component render element.
ComponentElement class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/ComponentElement.php Provides a Single-Directory Component render element.
ComponentEntityDisplayBase abstract class Drupal\migrate\Plugin\migrate\destination core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php Provides a destination plugin for migrating entity display components. 3 2
ComponentGenerator class Drupal\Composer\Generator composer/Generator/ComponentGenerator.php Reconciles Drupal component dependencies with core. 1
ComponentInvalidReplacementTest final class Drupal\Tests\sdc\Kernel core/modules/sdc/tests/src/Kernel/ComponentInvalidReplacementTest.php Tests invalid render options for components.
ComponentInvalidReplacementTest class Drupal\KernelTests\Components core/tests/Drupal/KernelTests/Components/ComponentInvalidReplacementTest.php Tests invalid render options for components.
ComponentKernelTestBase abstract class Drupal\Tests\Core\Theme\Component core/tests/Drupal/Tests/Core/Theme/Component/ComponentKernelTestBase.php Defines a base class for component kernel tests. 2
ComponentKernelTestBase abstract class Drupal\KernelTests\Components core/tests/Drupal/KernelTests/Components/ComponentKernelTestBase.php Defines a base class for component kernel tests. 6
ComponentKernelTestBase abstract class Drupal\Tests\sdc\Kernel core/modules/sdc/tests/src/Kernel/ComponentKernelTestBase.php Defines a base class for component kernel tests. 6
ComponentLoader class Drupal\Core\Template\Loader core/lib/Drupal/Core/Template/Loader/ComponentLoader.php Lets you load templates using the component ID.
ComponentMetadata class Drupal\Core\Theme\Component core/lib/Drupal/Core/Theme/Component/ComponentMetadata.php Component metadata. 2
ComponentMetadata final class Drupal\sdc\Component core/modules/sdc/src/Component/ComponentMetadata.php Component metadata. 2
ComponentMetadataTest final class Drupal\Tests\sdc\Unit core/modules/sdc/tests/src/Unit/ComponentMetadataTest.php Unit tests for the component metadata class.
ComponentMetadataTest class Drupal\Tests\Core\Theme\Component core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php Unit tests for the component metadata class.
ComponentNegotiator class Drupal\Core\Theme core/lib/Drupal/Core/Theme/ComponentNegotiator.php Determines which component should be used. 2
ComponentNegotiator final class Drupal\sdc core/modules/sdc/src/ComponentNegotiator.php Determines which component should be used. 1
ComponentNegotiatorTest final class Drupal\Tests\sdc\Kernel core/modules/sdc/tests/src/Kernel/ComponentNegotiatorTest.php Tests the component negotiator.
ComponentNegotiatorTest class Drupal\Tests\Core\Theme\Component core/tests/Drupal/Tests/Core/Theme/Component/ComponentNegotiatorTest.php Tests the component negotiator.
ComponentNegotiatorTest class Drupal\KernelTests\Components core/tests/Drupal/KernelTests/Components/ComponentNegotiatorTest.php Tests the component negotiator.
ComponentNodeVisitor class Drupal\Core\Template core/lib/Drupal/Core/Template/ComponentNodeVisitor.php Provides a ComponentNodeVisitor to change the generated parse-tree.
ComponentNodeVisitor final class Drupal\sdc\Twig core/modules/sdc/src/Twig/ComponentNodeVisitor.php Provides a ComponentNodeVisitor to change the generated parse-tree.
ComponentNodeVisitorTest final class Drupal\Tests\sdc\Kernel core/modules/sdc/tests/src/Kernel/ComponentNodeVisitorTest.php Tests the node visitor.
ComponentNodeVisitorTest class Drupal\KernelTests\Components core/tests/Drupal/KernelTests/Components/ComponentNodeVisitorTest.php Tests the node visitor.
ComponentNotFoundException class Drupal\Core\Render\Component\Exception core/lib/Drupal/Core/Render/Component/Exception/ComponentNotFoundException.php Raised when a component cannot be found. 7

Other projects


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