Problem/Motivation
Using Drupal 9 when creating a context with block reaction, I have the error below:
Drupal\Core\Security\UntrustedCallbackException: Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was Drupal\context\Plugin\ContextReaction\Blocks::preRenderBlock. See https://www.drupal.org/node/2966725 in Drupal\Core\Render\Renderer->doTrustedCallback() (line 96 of core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php).
Proposed resolution
The Blocks must implement the TrustedCallbackInterface.
See record changes: https://www.drupal.org/node/2966725
Comment | File | Size | Author |
---|---|---|---|
#6 | context-Render_#pre_render_callbacks-3158830-d9-6.patch | 1.56 KB | paulocs |
#3 | context-Render_#pre_render_callbacks-3158830-d9-3.patch | 1.2 KB | paulocs |
Comments
Comment #2
paulocsComment #3
paulocsFollow a patch.
Comment #4
paulocsComment #5
MaxMendez CreditAttribution: MaxMendez commentedThanks for patch, i've installed it on Drupal 9.0.2 and fixed the problem.
Comment #6
paulocsNew patch because it is needed to update the context.info.yml file as TrustedCallbackInterface was introduced in Drupal 8.8 version
Comment #7
paulocsFixed in dev branch!