EntityTypeInterface::getGroup() has the following short description.
Gets the machine name of the entity type group.
AFAICT, we don't anywhere explain what an entity type group actually is.
The documentation page should say that, in core, the group will either be content or config.
Issue fork drupal-3107500
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
longwaveIs this useful? Should we deprecate this? It doesn't seem to be used anywhere in core:
In contextual links, breakpoints and execution contexts "group" means a different thing, so as far as I can see this isn't actually used anywhere; I think we perhaps are better off using interfaces to identify this sort of thing.
Comment #3
longwaveThe same question was asked in #2549017-2: Add getGroup() and getGroupLabel() to an interface and add docs when it was first introduced.
Group *labels* are useful as per #2116551: Fix the UX of Entity Reference fields
Comment #4
joachim commented> Is this useful? Should we deprecate this? It doesn't seem to be used anywhere in core:
Yes! Anytime you want to get all content entities or all config entities. And I think it's much more elegant than using the interfaces.
See #3107499: use EntityTypeInterface::getGroup() instead of reflection for example.
Comment #8
larowlanAdding some tags to shed some light on this good novice/first issue
Comment #9
joachim commentedThis needs to say something like:
Comment #10
avpadernoComment #11
avpadernogroup is the value passed in the annotation for that entity type, which means that the values set by Drupal core are only a restrict set of possible values. They can be given as example, but the documentation should not make users think those are the only possible values.
The following interface properties should also be better documented.
At least, the first property should contain a reference to the interface method, if its documentation is going to explain what an entity type group is.
Comment #15
joachim commentedComment #16
smustgrave commentedRerunning tests. Though I'm 99% they were random failures.
Comment #17
smustgrave commentedYup random failures.
Reviewed the changes and now understand what entity groups are! haha
Comment #18
quietone commentedComment #19
joachim commentedFixed, and rebased.
Comment #20
longwaveLooks great to me now.
Comment #21
quietone commentedGood to see this being documented. I made a thorough read this time and have made some suggestion and I have some questions.
Comment #22
quietone commentedI re-read the changes and I think they are clear, correct and follow our standards. Back to RTBC
Comment #23
alexpottCommitted and pushed 817c02e84c to 10.1.x and 903768e429 to 10.0.x and 46f4d42d9a to 9.5.x. Thanks!
As a documentation improvement I backported this to 9.5.x