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

Created on 26 January 2023, almost 2 years ago
Updated 30 October 2023, about 1 year ago

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

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Documentation 

Last updated 1 day ago

No maintainer
Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024