Problem/Motivation
Several methods on EntityDisplayRepositoryInterface - all the get*Modes() - have @return docs that say something like this:
* @return array
* The view mode info for all entity types.
What is the 'info'? What is the array keyed by? The docs should say this.
Steps to reproduce
Proposed resolution
Complete the documentation.
It's probably fine for the entity type-specific flavours to refer to the general method for docs, to avoid repetition.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
joachim commentedThis should also say that the 'default' view mode is not returned -- using the return of one of these to iterate through getViewDisplay() for all modes will omit it!
Comment #8
govind_giri_goswami commentedEach method (e.g., getAllViewModes(), getViewModes(), getAllFormModes(), getFormModes()) is now individually documented. Previously, their return documentation simply stated @return array, lacking clarity on the array's structure. The updated documentation provides additional details for clarity, enhancing developers' understanding.
Comment #9
borisson_I think this is mostly better than what we had in the original docblocks, but the wording here is not something we typically use in Core. I think we should only include the ones we know for sure that exist.
Can we find documentation that is similar and copy the style?
Not sure what @joachim thinks about this
Comment #10
joachim commented> I think we should only include the ones we know for sure that exist.
Agreed.
If other keys might exist, we can say that, for instance (totally making this up) 'Further properties may be added by modules that implement hook_foo_alter()'.
If the return of all of these has the same format, I think it's ok to use a @see getAllViewModes() and only have the docs in one place.
Also see #2.
Comment #11
akshaydalvi212 commentedWill provide some docs for the returns values.
Comment #12
akshaydalvi212 commentedComment #13
rodrigoaguileraThe Drupal Contribution Mentoring team is triaging issues for DrupalCon Barcelona 2024, and we are reserving this issue for Mentored Contribution during the event.
After September 27, 2024, this issue returns to being open to all. Thanks!
By looking at the failed tests I think there is typo "Initail"
Comment #14
santhosh@21 commentedI am working on this issue
Comment #16
santhosh@21 commentedI have updated the spellcheck and the pipeline is failing in different functional tests related to the Umami and that doesn't suits for this document return type issue.
Comment #17
rodrigoaguileraDid a rebase and the pipeline is green again
Comment #18
sadamafridi commentedI have reviewed the fix, the pipeline is green and spell mistake has been corrected.
Comment #19
santhosh@21 commentedThank you @sadamafridi and @rodrigoaguilera for reviewing the issue and updating the comments
Comment #20
quietone commentedThanks for working on this!
The issue summary and title state this is for EntityDisplayRepositoryInterface() and yet there are changes to several files in the composer directory. Those are out of scope and should be moved to their own issue.
Thanks
Comment #21
quietone commentedI should have added that we do have guidelines for scoping of an issue, Issue scope guidelines for Drupal core issues. They explain why we limit the scope of an issue.
Comment #22
brandonlira commentedComment #23
brandonlira commentedHi everyone,
I have updated the merge request to remove unrelated changes in the composer/ directory and keep only the documentation improvements for EntityDisplayRepositoryInterface.php.
Now, the MR focuses solely on clarifying the return values for the getAllViewModes(), getViewModes(), getAllFormModes(), and getFormModes() methods, following the previous feedback.
Please review the changes and let me know if any further adjustments are needed.
Thanks!
Comment #24
brandonlira commentedComment #25
brandonlira commentedComment #26
smustgrave commentedDon't see any commit for #23
Comment #27
brandonlira commentedHi @smustgrave ,
I can confirm that my changes are included in the latest pipeline (#449876), even though the commit history might not explicitly show my name due to the rebase process.
The updates focus solely on documentation improvements for EntityDisplayRepositoryInterface.php MR !9637 , and all unrelated changes have been removed.
Please review and let me know if any further adjustments are needed.
Thanks!
Comment #28
brandonlira commentedComment #29
smustgrave commentedI don’t believe that’s true the MR is 700+ commits behind
Comment #30
brandonlira commentedHi @smustgrave,
I have successfully rebased the branch with the latest changes from 11.x. The MR is now up to date, and the documentation improvements remain intact.
Additionally, I have fixed the PHPCS violations by adjusting the line lengths to conform with Drupal coding standards.
I also noticed that some tests have failed
(`Drupal\Tests\package_manager\Build\PackageInstallTest` and `Drupal\Tests\ckeditor5\FunctionalJavascript\ImageUrlProviderTest`), but they do not seem to be related to the changes made in this MR.Let me know if any further adjustments are needed.
Thanks!
Comment #32
smustgrave commentedBelieve this one is good, reads fine to me
Comment #33
quietone commentedI updated credit.
Comment #37
quietone commentedThanks for improving documentation.
Pushed to 11.x and 11.1.x