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