Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293784

annotation docs should document how to set data types other than strings

$
0
0

API page: https://api.drupal.org/api/drupal/core%21core.api.php/group/annotation/10

The documentation for annotations shows examples of how to set string values, but is missing examples for other data types.

For example, seen in the ChangedItem class, we have:

 *   label = @Translation("Last changed"),
 *   description = @Translation("An entity field containing a UNIX timestamp of when the entity has been last updated."),
 *   no_ui = TRUE,
 *   default_widget = "datetime_timestamp",
 *   default_formatter = "timestamp",
 *   list_class = "\Drupal\Core\Field\ChangedFieldItemList"

and in CommentItem:

 *   cardinality = 1,

These show how to define:

- translated string
- boolean
- class (we should in particular say that classes need the initial slash)
- int


Viewing all articles
Browse latest Browse all 293784

Trending Articles