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.

CommentFileSizeAuthor
#2 3137435-2-entity-labels.patch2.11 KBtr

Comments

TR created an issue. See original summary.

tr’s picture

Status: Active » Needs review
StatusFileSize
new2.11 KB
pifagor’s picture

Status: Needs review » Reviewed & tested by the community

  • pifagor committed 2800866 on 8.x-3.x authored by TR
    Issue #3137435 by TR, pifagor: Update entity label annotations
    
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.