Problem/Motivation
Remaining deprecation notices:
2x: Render #post_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was render_example_add_prefix. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725
1x in RenderExampleMenuTest::testRenderExampleLinksExist from Drupal\Tests\render_example\Functional
1x in RenderExampleTest::testRenderExample from Drupal\Tests\render_example\Functional2x: Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was render_example_add_suffix. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725
1x in RenderExampleMenuTest::testRenderExampleLinksExist from Drupal\Tests\render_example\Functional
1x in RenderExampleTest::testRenderExample from Drupal\Tests\render_example\Functional1x: Drupal\Tests\BrowserTestBase::$defaultTheme is required in drupal:9.0.0 when using an install profile that does not set a default theme. See https://www.drupal.org/node/3083055, which includes recommendations on which theme to use.
1x in RenderExampleMenuTest::testRenderExampleLinksExist from Drupal\Tests\render_example\Functional1x: Render #lazy_builder callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was Drupal\render_example\Controller\RenderExampleController::lazyBuilder. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725
1x in RenderExampleMenuTest::testRenderExampleLinksExist from Drupal\Tests\render_example\Functional

| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3103583-4-after.png | 111.72 KB | jungle |
| #4 | 3103583-4-before.png | 177.04 KB | jungle |
| #3 | render-example-3103583-3.patch | 8.98 KB | valthebald |
| #3 | 3103583-pre.png | 13.39 KB | valthebald |
| #3 | interdiff-3103583-2-3.txt | 1.97 KB | valthebald |
Comments
Comment #2
jungleComment #3
valthebaldI've noticed that arrays() page lacks color:red attribute when it's added in a post_render callback:

(the issue existed before the patch, too).
I've added markup wrapper (with a comment), so now it's OK:

Also, slightly modified comments for pre/post render callbacks.
One remaining question that I have is: do we need $class variable that just stores static::class? IMO it makes the code slightly less readable - i.e. I need to wonder where this variable comes from, it takes some (little, but still) memory, and duplicates the information that we already have.
Comment #4
jungle1. Agree
2. Regards of readability, I am thinking of showing the example in a table to make those example more readable while visiting
For example, below is the output one example
But in code, it's just
If to show the original render array in code. not the one unrendered, but processed.
But this is out of the scope of this issue.
Comment #6
valthebaldCommitted to 8.x-1.x, thank you!