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
Following notice is thrown in PublishContentNode::render()
:
Notice: Only variables should be passed by reference in Drupal\Publishcontent\Plugin\Views\field\PublishContentNode->render() (line 56 of publishcontent/src/Plugin/views/field/PublishContentNode.php).
Proposed resolution
Store the render array first in a variable before passing it to the other render function.
Remaining tasks
Reviews needed.
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
publishcontent-only-variable-by-reference.patch | 626 bytes | das-peter | |
Comments
Comment #2
grahlPatch works fine, consider changing the variable name to a single word or camel-case.
Comment #3
Sut3kh CreditAttribution: Sut3kh as a volunteer commentedPatch works.
Maintainer does seem to prefer camel case vars but as there are none in the file I believe it is fine as per Drupal CS and not worth dragging out this 1 liner patch any longer IMO.
Comment #4
jeremyr CreditAttribution: jeremyr commentedAlso confirming that the patch worked.
Comment #5
arunkumarkTested the patch manually working like charm. There is no any notice error.
+1
Comment #7
das-peter CreditAttribution: das-peter at Cando commentedI guess that's fixed then :)
@johnennewThanks!