-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose pluralised form of entity label #37828
Conversation
Size Change: -3 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
@@ -217,6 +217,7 @@ async function loadPostTypeEntities() { | |||
baseURLParams: { context: 'edit' }, | |||
name, | |||
label: postType.labels.singular_name, | |||
labelPlural: postType.labels.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the plural form is already available in postType.name
, I don't mind having it here but I think the main problem right now is that the singular label is not available in the request using the "view" context. (The plural is available in all contexts)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh agree. That's why I don't think we could merge a PR like this until the Types API returns more label information for view
context requests.
Honestly I think it should be possible and feasible given that labels are not a sensitive piece of data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spacedmonkey Do you see it as achievable that we could get the Types API endpoint to return full labels
information about the Post Type for both view
and edit
contexts?
Closing this out. I don't think it's urgently needed right now. |
Description
Currently in
entities.js
we only access the singular form of the entity label. However when registering a Post Type we provide both singular and plural forms. This plural form comes in handy in many places including when we want to differentiate between singular or multiple copies of an entity.An example of this is the multi-entity saving flow where we want to show the singular or plural form of the entity name depending on the quantity of entities of a given type being saved.
This PR updates the entities to include
labelPlural
as well aslabel
(singular). It then applies that to the multi-entity saving flow.Note we were already doing this manually for the Template Parts so it makes sense to do it for all entity types.
Please also #37685 which if committed would make this change impossible.
How has this been tested?
Post
andNavigation Menu
- note the singular form.Navigation Menus
- note this is now using the plural form.Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist:
*.native.js
files for terms that need renaming or removal).