Annotations in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/core.api.php \annotation
Annotations for class discovery and metadata description.
The Drupal plugin system has a set of reusable components that developers can use, override, and extend in their modules. Most of the plugins use annotations, which let classes register themselves as plugins and describe their metadata. (Annotations can also be used for other purposes, though at the moment, Drupal only uses them for the plugin system.)
To annotate a class as a plugin, add code similar to the following to the end of the documentation block immediately preceding the class declaration:
* @ContentEntityType(
* id = "comment",
* label = @Translation("Comment"),
* ...
* base_table = "comment"
* )
Note that you must use double quotes; single quotes will not work in annotations.
Some annotation types, which extend the "@ PluginID" annotation class, have only a single 'id' key in their annotation. For these, it is possible to use a shorthand annotation. For example:
* @ViewsArea("entity")
in place of
* @ViewsArea(
* id = "entity"
*)
The available annotation classes are listed in this topic, and can be identified when you are looking at the Drupal source code by having "@ Annotation" in their documentation blocks (without the space after @). To find examples of annotation for a particular annotation class, such as EntityType, look for class files that have an @ annotation section using the annotation class.
See also
Annotation for translatable text
Annotation for context definition
File
- core/
core.api.php, line 1741 - Documentation landing page and topics, plus core library hooks.
Classes
Name | Location | Description |
---|---|---|
Action |
core/ |
Defines an Action annotation object. |
AggregatorFetcher |
core/ |
Defines a Plugin annotation object for aggregator fetcher plugins. |
AggregatorParser |
core/ |
Defines a Plugin annotation object for aggregator parser plugins. |
AggregatorProcessor |
core/ |
Defines a Plugin annotation object for aggregator processor plugins. |
All |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Archiver |
core/ |
Defines an archiver annotation object. |
Attribute |
vendor/ |
Annotation that can be used to signal to the parser to check the attribute type during the parsing process. |
Attributes |
vendor/ |
Annotation that can be used to signal to the parser to check the types of all declared attributes during the parsing process. |
Blank |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Block |
core/ |
Defines a Block annotation object. |
Callback |
vendor/ |
@Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"}) |
CardScheme |
vendor/ |
Metadata for the CardSchemeValidator. |
Choice |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
CKEditorPlugin |
core/ |
Defines a CKEditorPlugin annotation object. |
Collection |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Condition |
core/ |
Defines a condition plugin annotation object. |
ConfigEntityType |
core/ |
Defines a config entity type annotation object. |
Constraint |
core/ |
Defines a validation constraint annotation object. |
ConstraintA |
vendor/ |
|
ConstraintB |
vendor/ |
|
ConstraintC |
vendor/ |
|
ConstraintWithValue |
vendor/ |
|
ConstraintWithValueAsDefault |
vendor/ |
|
ContentEntityType |
core/ |
Defines a content entity type annotation object. |
ContextDefinition |
core/ |
Defines a context definition annotation object. |
Count |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Country |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Currency |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
DataType |
core/ |
Defines a data type annotation object. |
Date |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
DateTime |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
DisplayVariant |
core/ |
Defines a display variant annotation object. |
Editor |
core/ |
Defines an Editor annotation object. |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) | |
Entity |
vendor/ |
|
EntityReferenceSelection |
core/ |
Defines an EntityReferenceSelection plugin annotation object. |
EntityType |
core/ |
Defines an Entity type annotation object. |
Enum |
vendor/ |
Annotation that can be used to signal to the parser to check the available values during the parsing process. |
EqualTo |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Expression |
vendor/ |
@Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"}) |
False Deprecated |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
FieldFormatter |
core/ |
Defines a FieldFormatter annotation object. |
FieldType |
core/ |
Defines a FieldType annotation object. |
FieldWidget |
core/ |
Defines a FieldWidget annotation object. |
File |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Filter |
core/ |
Defines an filter annotation object. |
FormElement |
core/ |
Defines a form element plugin annotation object. |
GreaterThan |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
GreaterThanOrEqual |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Groups |
vendor/ |
Annotation class for @Groups(). |
GroupSequence Deprecated |
vendor/ |
A sequence of validation groups. |
GroupSequenceProvider |
vendor/ |
Annotation to define a group sequence provider. |
Iban |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
IdenticalTo |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
IgnoreAnnotation |
vendor/ |
Annotation that can be used to signal to the parser to ignore specific annotations during the parsing process. |
Image |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
ImageEffect |
core/ |
Defines an image effect annotation object. |
ImageToolkit |
core/ |
Defines a Plugin annotation object for the image toolkit plugin. |
ImageToolkitOperation |
core/ |
Defines a Plugin annotation object for the image toolkit operation plugin. |
InPlaceEditor |
core/ |
Defines an InPlaceEditor annotation object. |
Ip |
vendor/ |
Validates that a value is a valid IP address. |
Isbn |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
IsFalse |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
IsNull |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Issn |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
IsTrue |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Language |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
LanguageNegotiation |
core/ |
Defines a language negotiation annotation object. |
Length |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
LessThan |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
LessThanOrEqual |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Locale |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Luhn |
vendor/ |
Metadata for the LuhnValidator. |
core/ |
Defines a Mail annotation object. | |
MigrateCckField |
core/ |
Defines a cckfield plugin annotation object. |
MigrateDestination |
core/ |
Defines a migration destination plugin annotation object. |
MigrateProcessPlugin |
core/ |
Defines a migration process plugin annotation object. |
MigrateSource |
core/ |
Defines a migration source plugin annotation object. |
NotBlank |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
NotEqualTo |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
NotIdenticalTo |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
NotNull |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Null Deprecated |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Optional |
vendor/ |
@Target({"ANNOTATION"}) |
Optional Deprecated |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
PageDisplayVariant |
core/ |
Defines a page display variant annotation object. |
Plugin |
core/ |
Defines a Plugin annotation object. |
PluginExample |
core/ |
Defines a custom Plugin annotation. |
PluginID |
core/ |
Defines a Plugin annotation object that just contains an ID. |
QueueWorker |
core/ |
Declare queue workers that need to be run periodically. |
Range |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Regex |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
RenderElement |
core/ |
Defines a render element plugin annotation object. |
Required |
vendor/ |
@Target({"ANNOTATION"}) |
Required Deprecated |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Required |
vendor/ |
Annotation that can be used to signal to the parser to check if that attribute is required during the parsing process. |
RestResource |
core/ |
Defines a REST resource annotation object. |
Route |
vendor/ |
Annotation class for @Route(). |
SearchPlugin |
core/ |
Defines a SearchPlugin type annotation object. |
Target |
vendor/ |
Annotation that can be used to signal to the parser to check the annotation target during the parsing process. |
Time |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Tip |
core/ |
Defines a tour item annotation object. |
Translation |
core/ |
Defines a translatable annotation object. |
Traverse |
vendor/ |
@since 2.5 |
True Deprecated |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Type |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Url |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
Uuid |
vendor/ |
@author Colin O'Dell <colinodell@gmail.com> @author Bernhard Schussek <bschussek@gmail.com> |
Valid |
vendor/ |
@Target({"PROPERTY", "METHOD", "ANNOTATION"}) |
ViewsAccess |
core/ |
Defines a Plugin annotation object for views access plugins. |
ViewsArea |
core/ |
Defines a Plugin annotation object for views area handlers. |
ViewsArgument |
core/ |
Defines a Plugin annotation object for views argument handlers. |
ViewsArgumentDefault |
core/ |
Defines a Plugin annotation object for views argument default plugins. |
ViewsArgumentValidator |
core/ |
Defines a Plugin annotation object for views argument validator plugins. |
ViewsCache |
core/ |
Defines a Plugin annotation object for views cache plugins. |
ViewsDisplay |
core/ |
Defines a Plugin annotation object for views display plugins. |
ViewsDisplayExtender |
core/ |
Defines a Plugin annotation object for views display extender plugins. |
ViewsExposedForm |
core/ |
Defines a Plugin annotation object for views exposed form plugins. |
ViewsField |
core/ |
Defines a Plugin annotation object for views field handlers. |
ViewsFilter |
core/ |
Defines a Plugin annotation object for views filter handlers. |
ViewsJoin |
core/ |
Defines a Plugin annotation object for views join plugins. |
ViewsPager |
core/ |
Defines a Plugin annotation object for views pager plugins. |
ViewsQuery |
core/ |
Defines a Plugin annotation object for views query plugins. |
ViewsRelationship |
core/ |
Defines a Plugin annotation object for views relationship handlers. |
ViewsRow |
core/ |
Defines a Plugin annotation object for views row plugins. |
ViewsSort |
core/ |
Defines a Plugin annotation object for views sort handlers. |
ViewsStyle |
core/ |
Defines a Plugin annotation object for views style plugins. |
ViewsWizard |
core/ |
Defines a Plugin annotation object for views wizard plugins. |