Problem/Motivation

The empty message on /admin/structure/menu/ogmenu currently reads "There are no og menu entities yet."

Neither OgMenu nor OgMenuInstance defines label_collection, label_singular, label_plural, or label_count. Core therefore falls back to generated labels such as "og menu entities". These labels are used by EntityListBuilder and other code calling getCollectionLabel(), getSingularLabel(), getPluralLabel(), or getCountLabel().

Core config bundle entities such as Menu and NodeType define these labels explicitly.

Steps to reproduce

  1. Install og_menu with no OG Menus defined.
  2. Visit /admin/structure/menu/ogmenu.
  3. Observe "There are no og menu entities yet."

Proposed resolution

Add complete entity type labels to both OgMenu and OgMenuInstance, in both the PHP attribute and legacy annotation, following core's Menu entity.

For OgMenu:

label_collection: new TranslatableMarkup('OG Menus'),
label_singular: new TranslatableMarkup('OG menu'),
label_plural: new TranslatableMarkup('OG menus'),
label_count: [
  'singular' => '@count OG menu',
  'plural' => '@count OG menus',
],

For OgMenuInstance:

label_collection: new TranslatableMarkup('OG Menu instances'),
label_singular: new TranslatableMarkup('OG menu instance'),
label_plural: new TranslatableMarkup('OG menu instances'),
label_count: [
  'singular' => '@count OG menu instance',
  'plural' => '@count OG menu instances',
],

Keep "OG menus" rather than "OG menu types" to match the terminology already used throughout the module's UI and core's naming of its Menu config entity.

Remaining tasks

  • Add the labels to both entity types.
  • Add a kernel test covering the collection, singular, plural, and count labels for both entity types.
  • Review whether the hard-coded _title: 'OG Menu' on entity.ogmenu.collection should become "OG Menus" to match label_collection.

User interface changes

The empty-list message on /admin/structure/menu/ogmenu becomes "There are no OG menus yet." Other generated UI using these entity type labels also gains the correct singular and plural wording.

Issue fork og_menu-3624535

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review

  • joelpittet committed d8192422 on 2.x
    task: #3624535 Add complete entity type labels to OgMenu and...
joelpittet’s picture

Status: Needs review » Fixed

Merged, labels are all consistent now. ahhh

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.