obsolete docs about drupal_pre_render_links()

Created on 26 March 2024, 9 months ago
Updated 12 April 2024, 8 months ago

Problem/Motivation

Comment and node links documentation mention drupal_pre_render_links but that function no longer exists.

This should say \Drupal\Core\Render\Element\Link::preRenderLinks() instead.

(It's a total WTF that a #theme links is hacking into a prerender callback for #type links, but out of scope here.)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

10.2

Component
Documentation 

Last updated 1 day ago

No maintainer
Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @joachim
  • 🇫🇮Finland markusVJH

    Hi Joachim, thanks for tagging this in novice. I am working on this today

  • Status changed to Needs review 9 months ago
  • Pipeline finished with Success
    9 months ago
    Total: 523s
    #131469
  • Status changed to RTBC 9 months ago
  • 🇺🇸United States smustgrave

    Seems correct. Searched repo for drupal_pre_render_links and these were the only 2 instances.

  • Status changed to Fixed 9 months ago
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    Committed and pushed 61018bfeba to 11.x and 7686fb5a20 to 10.3.x and faf7f1505d to 10.2.x. Thanks!

    diff --git a/core/modules/comment/src/CommentLazyBuilders.php b/core/modules/comment/src/CommentLazyBuilders.php
    index dd945ca4d5..d553411b9f 100644
    --- a/core/modules/comment/src/CommentLazyBuilders.php
    +++ b/core/modules/comment/src/CommentLazyBuilders.php
    @@ -161,7 +161,9 @@ public function renderLinks($comment_entity_id, $view_mode, $langcode, $is_in_pr
        *   The entity to which the comment is attached.
        *
        * @return array
    -   *   An array that can be processed by \Drupal\Core\Render\Element\Link::preRenderLinks().
    +   *   An array that can be processed by Link::preRenderLinks().
    +   *
    +   * @see \Drupal\Core\Render\Element\Link::preRenderLinks()
        */
       protected function buildLinks(CommentInterface $entity, EntityInterface $commented_entity) {
         $links = [];
    diff --git a/core/modules/node/src/NodeViewBuilder.php b/core/modules/node/src/NodeViewBuilder.php
    index 20e15f4a99..b4ab0b5d0f 100644
    --- a/core/modules/node/src/NodeViewBuilder.php
    +++ b/core/modules/node/src/NodeViewBuilder.php
    @@ -119,7 +119,9 @@ public static function renderLinks($node_entity_id, $view_mode, $langcode, $is_i
        *   A view mode identifier.
        *
        * @return array
    -   *   An array that can be processed by \Drupal\Core\Render\Element\Link::preRenderLinks().
    +   *   An array that can be processed by Link::preRenderLinks().
    +   *
    +   * @see \Drupal\Core\Render\Element\Link::preRenderLinks()
        */
       protected static function buildLinks(NodeInterface $entity, $view_mode) {
         $links = [];
    

    Ensured the @return is within the 80 chars limit for comments and added an @see.

    • alexpott committed faf7f150 on 10.2.x
      Issue #3436070 by markusVJH, joachim: obsolete docs about...
    • alexpott committed 7686fb5a on 10.3.x
      Issue #3436070 by markusVJH, joachim: obsolete docs about...
    • alexpott committed 61018bfe on 11.x
      Issue #3436070 by markusVJH, joachim: obsolete docs about...
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024