Problem/Motivation

I'm getting this error on a Drupal 9 site:

Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface

Steps to reproduce

Set up the image media type to use pins, with the default text plugin.

Proposed resolution

This is hitting a core change to use class functions for element pre/post render for security reasons:

https://www.drupal.org/node/2966725

I created a new class called ImagepinRender and moved the pre/post process functions into it.

The other option is to implement this as an anonymous function. For consideration, this is called from a field preprocessor and the code is in imagepin.attach.inc.

Remaining tasks

Discuss solution and review patch.

User interface changes

none.

API changes

none.

Data model changes

none.

CommentFileSizeAuthor
imagepin-render-class.patch3.31 KBmortona2k

Comments

mortona2k created an issue. See original summary.

mortona2k’s picture

Status: Active » Needs review

  • nitesh624 committed 2d1869f on 8.x-1.x authored by mortona2k
    Issue #3207018 by mortona2k: Implement pre/post process functions as...
nitesh624’s picture

Status: Needs review » Fixed
mxh’s picture

Status: Fixed » Needs work

@mortona2k Thank you for creating the issue and writing the patch.

@nitesh64 I appreciate your maintenance work on this module, but please do not commit patches which were not reviewed. Please make sure that only patches are being committed that were reviewed and at least fulfill coding formatting standards. The committed patch does not fulfill coding standards, e.g. class comment is missing and namespace usage is wrong. Please have a look at https://www.drupal.org/docs/develop/standards/coding-standards regards formatting rules.

Please correct standards and perform at least one review by another person.

nitesh624’s picture

Status: Needs work » Fixed

Thanks @mxh i haeing updated the branch and fix the coding standard issues. closing this.
https://git.drupalcode.org/project/imagepin/-/commit/ce91658b6207f4e5734...

Status: Fixed » Closed (fixed)

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