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.

Replace references to drupal_render() with RenderInterface::render() in @param, @return, @see, @link, etc. references.

Proposed resolution

grep -rn -B 5 -A 5 drupal_render core | grep -E '@link|@param|@return|@see'
Perform a grep in core/ folder for all drupal_render string and display 5 or more lines before and after the match occurrence. Then perform grep again on the output of previous grep to filter @link|@param|@return|@see.

  1. grep -rn -B 5 -A 5 drupal_render core will search for drupal_render inside core folder and will display 5 lines before and after the match occurence.
  2. grep -E '@link|@param|@return|@see' will perform search on previous grep result and will grep all the @link|@param|@return|@see.

Update references as appropriate.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jo Fitzgerald created an issue. See original summary.

MerryHamster’s picture

The beginning of the division of the big patch))
One moment is not clear for me: where (I mean issue) do we need to add changes to descriptions of functions?
Here or to another issue?

MerryHamster’s picture

Status: Active » Needs review
msankhala’s picture

Issue summary: View changes
Status: Needs review » Needs work

@MerryHamster Thanks for the patch.

+++ b/core/modules/node/node.module
@@ -806,7 +806,8 @@ function node_get_recent($number = 10) {
+ *   An array as expected by
+ *   \Drupal\Core\Render\RendererInterface::render().

\Drupal\Core\Render\RendererInterface::render() should be on the same line if line length does not exceed 80 characters. This same applies to all places.

One moment is not clear for me: where (I mean issue) do we need to add changes to descriptions of functions?

I think the changes in function description should be done in #2938969: Replace drupal_render() in docblock and comments outside of @param, @return, @link, @see and outside of @code - @endcode.

I think there are few more places with @param, @return, @see, @link which mention drupal_render. I have updated the issue summary to help you with this.

MerryHamster’s picture

FileSize
25.55 KB
3.17 KB

fixed #4 remark

MerryHamster’s picture

Status: Needs work » Needs review
MerryHamster’s picture

FileSize
26.85 KB
4.61 KB

oh, I found some more plases with 'drupal_render' with @param, @return, @see, @link
thanks @msankhala for tip with grep

msankhala’s picture

Status: Needs review » Needs work

@MerryHamster its almost there.

  1. +++ b/core/lib/Drupal/Core/Entity/Controller/EntityListController.php
    @@ -16,7 +16,7 @@ class EntityListController extends ControllerBase {
    +   *   A render array as expected by \Drupal\Core\Render\RendererInterface::render().
    

    line length in docblock should not be more than 80 characters.

  2. +++ b/core/modules/views/views.module
    @@ -325,10 +325,10 @@ function views_theme_suggestions_container_alter(array &$suggestions, array $var
    - *   The renderable array to which contextual links will be added. This array
    

    I think you deleted the first line by mistake.

surbz’s picture

Thanks @MerryHamster for this great patch, I was reading through and found that #7 covers most of it also the feedback mentioned in #8 was real quick and I have addressed these changes here.

Thanks @msankhala for reviewing this.
2938970-9.patch now contains changes requested in #8 and is ready for review.

surbz’s picture

Status: Needs work » Needs review
msankhala’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Entity/Controller/EntityListController.php
@@ -16,7 +16,8 @@ class EntityListController extends ControllerBase {
+   *   A render array as expected by ¶

Thanks, @surbz for the updated patch. One small fix though. It has one trailing white space.

surbz’s picture

Aaah! Thanks for noticing that.
Here is the updated one \m/

surbz’s picture

Status: Needs work » Needs review
andypost’s picture

@surbz please add interdiff of changes you made, ref https://www.drupal.org/documentation/git/interdiff

surbz’s picture

FileSize
1.49 KB

Attaching the interdiff .

msankhala’s picture

Status: Needs review » Reviewed & tested by the community

Patch #12 applies cleanly and interdiff-7-12.txt looks fine. This patch removed all the drupal_render inside @param, @return, @see, @link, etc. After applying this patch drupal_render are only left inside one line summaries or outside of @param, @return, @see, @link that should be fixed in #2938969: Replace drupal_render() in docblock and comments outside of @param, @return, @link, @see and outside of @code - @endcode

After applying the patch I verified this with this command on mac.

grep -rn -B 5 -A 5 drupal_render core | grep -E '@link|@param|@return|@see' | awk -F'-' -v colon=':' '{print $1 colon $2}' | xargs subl

This command will open all the files in sublime where drupal_render is found. Then you can verify that drupal_render is only left outside of @param, @return, @see, @link. This command assumes that you have sublime added in your shell PATH. Otherwise run ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl to add sublime in your path.

alexpott credited ZeiP.

alexpott credited darrenwh.

alexpott credited ritzz.

alexpott credited tameeshb.

alexpott credited wturrell.

alexpott credited xjm.

alexpott’s picture

Adding credit from the parent issue.

alexpott’s picture

Crediting @msankhala for reviews on this issue.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Backported to 8.5.x as this is a docs patch.

Committed and pushed 3bfc5a384b to 8.6.x and e8157ca90a to 8.5.x. Thanks!

  • alexpott committed 3bfc5a3 on 8.6.x
    Issue #2938970 by MerryHamster, surbz, msankhala, alexpott, Jo...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.