Entity types used to have only one type of label, but now we have label, label_singular, label_plural, label_count, and label_collection (see Entity types can specify plural labels now and Entity types can specify collection labels now). The core Entity API also introduced new functions, which are used for displaying the entity labels in context: getSingularLabel(), getPluralLabel(), getCountLabel(), getCollectionLabel().
Providing these extra labels allows the entity name to be properly displayed for the context it's used in. When used in Rules entity events, conditions, and actions, for example.
Change records:
Entity types can specify plural labels now (06-Apr-2016 )
Entity types can specify collection labels now (30-Jan-2017)
It is strongly recommended that each entity type provides [these keys]
See for example core/modules/node/src/Entity/Node.php:
* label = @Translation("Content"),
* label_collection = @Translation("Content"),
* label_singular = @Translation("content item"),
* label_plural = @Translation("content items"),
* label_count = @PluralTranslation(
* singular = "@count content item",
* plural = "@count content items"
* ),Patch adds these new annotation keys to the entities defined by the Voting API module.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3137435-2-entity-labels.patch | 2.11 KB | tr |
Comments
Comment #2
tr commentedComment #3
pifagor commentedComment #5
pifagor commented