Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The patch being prepared in #2834889: Replace documentation and string references to drupal_render() was becoming unwieldy so it was decided that it should be split into smaller chunks.
Rewrite one-line summaries that refer to drupal_render(), since unlike most things these aren't going to work as straight string-replaces. They probably shouldn't refer to it anyway; it's an implementation detail. Usually, "during rendering" or such is probably an acceptable substitution in one-line summaries.
Proposed resolution
Update references as appropriate.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#37 | RenderElementTypesTest.png | 11.17 KB | gabriel.abdalla |
#37 | ThemeTest.png | 11.15 KB | gabriel.abdalla |
#36 | 2938969-36.patch | 33.72 KB | paulocs |
#36 | interdiff-34-36.txt | 7.93 KB | paulocs |
#34 | interdiff-26-34.txt | 18.57 KB | TR |
Comments
Comment #2
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedShouldn't we change this issue title Replace drupal_render() in one-line summaries => Replace drupal_render() in docblock and comments outside of @param, @return, @link, @see and outside of @code - @endcode
because drupal_render is also mentioned in docblocks and comments which are not the one-line summary. Rest
drupal_render()
in dockblocks are already fixed in #2938970: Replace drupal_render() in @param, @return, @see, @link, etc. and #2938972: Replace drupal_render() in sample codeAfter fixing this issue
drupal_render
will only remain in actual code in function/method body, not in docblock or comments which can be fixed in #2938973: Replace drupal_render() within the Render componentComment #3
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHere is my first patch according to my comment #2. After this patch
drupal_render()
only remains incore/include/common.inc
where it is actually referencing todrupal_render()
function.Comment #4
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #6
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHere is updated patch.
Comment #7
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #9
MerryHamster CreditAttribution: MerryHamster at Skilld commentedreroll to 8.7.x, and added little fixes
Comment #10
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commented@MerryHamster Thanks for working on this issue. I can confirm the patch #9 is fixing all the mention of
drupal_render()
as per issue title. After applying the patch the only places wheredrupal_render()
is remaining is inside the actual render components or tests which should be fixed in #2938973: Replace drupal_render() within the Render componentMention of drupal_render() inside the
core/includes/common.inc
is expected.After applying the patch:
I am using ripgrep to search, you can verify the same with grep.
Comment #13
catchComment #23
catchCrediting people from the parent issue.
Comment #24
alexpottThese need to be a one-liner to comply with coding standards.
Comment #25
dhirendra.mishra CreditAttribution: dhirendra.mishra at Srijan | A Material+ Company commentedi am working on it.
Comment #26
dhirendra.mishra CreditAttribution: dhirendra.mishra at Srijan | A Material+ Company commentedPls find the Updated patch and interdiff.
Comment #27
alexpottThese have to be one line and less than 80 cols. It's tricky.
Also I'm not sure the interdiff is correct because it looks like it is adding new
drupal_render()
usages being introduced but there are no in the patch.Comment #28
dhirendra.mishra CreditAttribution: dhirendra.mishra at Srijan | A Material+ Company commentedI don't know what gone wrong with interdiff file in comment #26. But patch file looks ok to me.
@alexpott, If u look at patch file then all changes are already included.
Comment #34
TR CreditAttribution: TR commentedThe patch in #26 did not address the comments in #24 or #27.
Here is a new patch re-rolled against HEAD which fixes all the things pointed out in all the previous comments. This patch also fixes six places that weren't touched by the patch in #26. After this patch there are no more references to drupal_render() in the codebase.
The interdiff is a bit messed up because the line numbers of some of the hunks have changed so much in the past three years that interdiff can't match up the hunks properly. Because the previous patch is so old, I suggest ignoring the interdiff and reviewing this from scratch.
Comment #35
longwaveSome feedback below.
#2794261: Deprecate render() function in common.inc is tangentially related, if anyone wants to review.
I think this should just refer to RendererInterface::render().
Same
Same
And again, because that is where the relevant docs live.
Same.
#sorted is not checked by the renderer itself, should this refer to Element::children()?
Again I think this should refer to the interface.
Same as before, render() does not reorder the links anyway.
This could just say "render cache" I think?
I would just drop "by" and everything after it.
Comment #36
paulocsNew patch that addresses #35.
Comment #37
gabriel.abdalla CreditAttribution: gabriel.abdalla at CI&T commentedHi, patch 2938969-36.patch looks good.
Steps performed:
1. Got code from 9.3.x-dev.
2. Applied 2938969-36.patch.
3. Reviewed all changed files.
4. Checked PHPCS (Drupal and DrupalPractice standards) against all changed files. No issues have been introduced.
5. Tested classes which had changes in assert methods. Tests passed (images attached).
Comment #38
longwaveThanks for reviewing, Just to let you know, you don't need to manually check phpcs or run the tests; the bot will do that for you and the box below the patch won't be green if there are coding standards issues or test failures - you also don't need to attach screenshots of the tests passing.
Comment #39
alexpott@gabriel.abdalla thank you for looking into this issue.
Posting screenshots of your codebase or command-line interface does not advance the issue, since the automated testing infrastructure tells us whether the change set still applies correctly.
So, I've removed the issue credit for that screenshot. In the future, you can get credit for issues by reading the issue to understand its purpose, and posting your review or testing of that purpose. Thank you!
RTBC'ing a comment changing issue like this one it is quite difficult to meet the standard that would be credited - the review doesn't deal with the most important thing to review which is that no new comments have been introduced using to drupal_render(). The review in #35 is a good example of a comment that will be credited.
Comment #40
alexpottCommitted and pushed 84fc7490b1 to 9.3.x and f429dac245 to 9.2.x. Thanks!
As a patch that only changes comments backported to 9.2.x
Comment #43
alexpottWe need a follow-up to do the same for references to render() since that function is now deprecated.
Comment #44
longwave@alexpott Don't we usually only remove docs references once the deprecated function is actually removed?
Comment #45
alexpott@longwave not really. I think documentation should reflect the currently correct way of doing things. Telling people to use deprecated code is a recipe for them having to do future work.
Comment #46
TR CreditAttribution: TR commented@alexpott Maybe you can weigh in on #3224178: Remove theme function documentation from theme.api.php then ?