You are here

Classes, traits, and interfaces in Drupal 9

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

Namesort descending Type Namespace Location Description Direct uses Use statements Strings
AllowedValuesConstraint class Drupal\Core\Validation\Plugin\Validation\Constraint core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraint.php Checks for the value being allowed. 1
AllowedValuesConstraintValidator class Drupal\Core\Validation\Plugin\Validation\Constraint core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php Validates the AllowedValues constraint.
AllowedValuesConstraintValidatorTest class Drupal\KernelTests\Core\TypedData core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php Tests AllowedValues validation constraint with both valid and invalid values.
AllowToolbarPath class Drupal\toolbar\PageCache core/modules/toolbar/src/PageCache/AllowToolbarPath.php Cache policy for the toolbar page cache service. 1 2
AllowToolbarPathTest class Drupal\Tests\toolbar\Unit\PageCache core/modules/toolbar/tests/src/Unit/PageCache/AllowToolbarPathTest.php @coversDefaultClass \Drupal\toolbar\PageCache\AllowToolbarPath @group toolbar
AlreadyInstalledException class Drupal\Core\Installer\Exception core/lib/Drupal/Core/Installer/Exception/AlreadyInstalledException.php Exception thrown if Drupal is installed already. 1
AlterableInterface interface Drupal\Core\Database\Query core/lib/Drupal/Core/Database/Query/AlterableInterface.php Interface for a query that can be manipulated via an alter hook. 2 13
AlterTest class Drupal\KernelTests\Core\Database core/tests/Drupal/KernelTests/Core/Database/AlterTest.php Tests the hook_query_alter capabilities of the Select builder.
AlterTest class Drupal\Tests\system\Functional\Common core/modules/system/tests/src/Functional/Common/AlterTest.php Tests alteration of arguments passed to \Drupal::moduleHandler->alter().
AlterTest class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/AlterTest.php Tests hook_form_alter() and hook_form_FORM_ID_alter().
AmbiguousEntityClassException class Drupal\Core\Entity\Exception core/lib/Drupal/Core/Entity/Exception/AmbiguousEntityClassException.php Exception thrown if multiple entity types exist for an entity class. 2
Analyze class Drupal\views_ui\Form\Ajax core/modules/views_ui/src/Form/Ajax/Analyze.php Displays analysis information for a view.
Analyzer class Drupal\views core/modules/views/src/Analyzer.php This tool is a small plugin manager to perform analysis on a view and report results to the user. This tool is meant to let modules that provide data to Views also help users properly use that data by detecting invalid configurations. Views itself… 3 2
AnalyzeTest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/AnalyzeTest.php Tests the views analyze system.
AnnotatedClassDiscovery class Drupal\Core\Plugin\Discovery core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php Defines a discovery mechanism to find annotated plugins in PSR-4 namespaces. 1 8
AnnotatedClassDiscovery class Drupal\Component\Annotation\Plugin\Discovery core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php Defines a discovery mechanism to find annotated plugins in PSR-4 namespaces. 1 4
AnnotatedClassDiscoveryAutomatedProviders class Drupal\migrate\Plugin\Discovery core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php Determines providers based on a class's and its parent's namespaces. 1
AnnotatedClassDiscoveryCachedTest class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery @group Annotation @runTestsInSeparateProcesses
AnnotatedClassDiscoveryTest class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery @group Annotation @runTestsInSeparateProcesses
AnnotatedClassDiscoveryTest class Drupal\Tests\Component\Plugin\Discovery core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery
AnnotatedClassDiscoveryTest class Drupal\KernelTests\Core\Plugin\Discovery core/tests/Drupal/KernelTests/Core/Plugin/Discovery/AnnotatedClassDiscoveryTest.php Tests that plugins are correctly discovered using annotated classes.
AnnotationBase abstract class Drupal\Component\Annotation core/lib/Drupal/Component/Annotation/AnnotationBase.php Provides a base class for classed annotations. 5 4
AnnotationBaseStub class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php
AnnotationBaseTest class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php @coversDefaultClass \Drupal\Component\Annotation\AnnotationBase @group Annotation
AnnotationBridgeDecorator class Drupal\Component\Annotation\Plugin\Discovery core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecorator.php Ensures that all definitions are run through the annotation process. 2
AnnotationBridgeDecoratorTest class Drupal\Tests\Component\Annotation\Plugin\Discovery core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator @group Plugin
AnnotationEnum final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationEnum.php Plugin annotation @Target("ALL");
AnnotationEnumInvalid final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationEnumInvalid.php Plugin annotation @Target("ALL");
AnnotationEnumLiteral final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationEnumLiteral.php Plugin annotation @Target("ALL"); 1
AnnotationEnumLiteralInvalid final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationEnumLiteralInvalid.php Plugin annotation @Target("ALL");
AnnotationExtendsAnnotationTargetAll class Drupal\Tests\Component\Annotation\Doctrine core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
AnnotationInterface interface Drupal\Component\Annotation core/lib/Drupal/Component/Annotation/AnnotationInterface.php Defines a common interface for classed annotations. 3 4
AnnotationTargetAll class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationTargetAll.php Plugin annotation @Target("ALL"); 1 1
AnnotationTargetAnnotation final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationTargetAnnotation.php Plugin annotation @Target({ "ANNOTATION" }) 1
AnnotationTargetClass final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationTargetClass.php Plugin annotation @Target("CLASS"); 3
AnnotationTargetPropertyMethod final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationTargetPropertyMethod.php Plugin annotation @Target({ "METHOD", "PROPERTY" }) 2
AnnotationWithAttributes final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationWithAttributes.php Plugin annotation @Target("ALL") @Attributes({ @Attribute("mixed", type = "mixed"), @Attribute("boolean", type = "boolean"), @Attribute("bool", type = "bool"), @Attribute("float", …
AnnotationWithConstants final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationWithConstants.php Plugin annotation @Target("ALL"); 1
AnnotationWithInvalidTargetDeclaration class Drupal\Tests\Component\Annotation\Doctrine core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php Plugin annotation @Target("Foo");
AnnotationWithRequiredAttributes final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationWithRequiredAttributes.php Plugin annotation @Target("ALL") @Attributes({ @Attribute("value", required = true , type = "string"), @Attribute("annot", required = true , type =…
AnnotationWithRequiredAttributesWithoutContructor final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationWithRequiredAttributesWithoutContructor.php Plugin annotation @Target("ALL");
AnnotationWithTargetEmpty class Drupal\Tests\Component\Annotation\Doctrine core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php @Target
AnnotationWithTargetSyntaxError final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationWithTargetSyntaxError.php Plugin annotation @Target(@)
AnnotationWithVarType final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/AnnotationWithVarType.php Plugin annotation @Target("ALL");
AnnotWithDefaultValue class Drupal\Tests\Component\Annotation\Doctrine\Fixtures\Annotation core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/Annotation/AnnotWithDefaultValue.php
AnnounceCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/AnnounceCommand.php AJAX command for a JavaScript Drupal.announce() call. 3
AnonResourceTestTrait trait Drupal\Tests\rest\Functional core/modules/rest/tests/src/Functional/AnonResourceTestTrait.php Trait for ResourceTestBase subclasses testing $auth=NULL, i.e. authless/anon. 162
AnonymousPrivateTempStoreTest class Drupal\KernelTests\Core\TempStore core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php Tests the PrivateTempStore for anonymous users.
AnonymousUserResponseSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/AnonymousUserResponseSubscriber.php Response subscriber to handle finished responses for the anonymous user. 2
AnonymousUserSession class Drupal\Core\Session core/lib/Drupal/Core/Session/AnonymousUserSession.php An account implementation representing an anonymous user. 16

Pages

Other projects