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
- Install
og_menuwith no OG Menus defined. - Visit
/admin/structure/menu/ogmenu. - 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'onentity.ogmenu.collectionshould become "OG Menus" to matchlabel_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
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
Comment #2
joelpittetComment #5
joelpittetMerged, labels are all consistent now. ahhh