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

label_collection is defined twice in BlockContentType entity annotation

$
0
0

Problem/Motivation

The annotation in core/modules/block_content/src/Entity/BlockContentType.php looks like this:

 * @ConfigEntityType(
 *   id = "block_content_type",
 *   label = @Translation("Custom block type"),
 *   label_collection = @Translation("Custom block types"),
 *   label_singular = @Translation("custom block type"),
 *   label_plural = @Translation("custom block types"),
 *   label_count = @PluralTranslation(
 *     singular = "@count custom block type",
 *     plural = "@count custom block types",
 *   ),
 *   label_collection = @Translation("Custom block library"),

Proposed resolution

As you can see, label_collection is defined TWICE.

  1. The first label_collection was added as part of an older issue to add entity labels: #2702683: Add plural labels to entity types
  2. The second label_collection was committed two months earlier than that, by: #2919890: Make BlockContentType use a route provider instead of hard-coded routes

I checked all content and config entities defined by core, for duplicate use of label, label_collection, label_singular, label_plural, or label_count, and this is the only instance of duplicate labels I found.

This problem exists in D8.8, D8.9, D9.0, and D9.1.

The patch removes the second use of label_collection because the text is not consistent with the other labels.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None


Viewing all articles
Browse latest Browse all 298538

Trending Articles