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\Functional

2x: 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\Functional

1x: 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\Functional

1x: 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

Comments

jungle created an issue. See original summary.

jungle’s picture

Assigned: jungle » Unassigned
Status: Active » Needs review
StatusFileSize
new8.77 KB
valthebald’s picture

Issue summary: View changes
StatusFileSize
new13.39 KB
new8.16 KB
new1.97 KB
new8.98 KB

I'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.

jungle’s picture

StatusFileSize
new177.04 KB
new111.72 KB

it makes the code slightly less readable

1. 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

    $build['simple'] = [
      '#markup' => '<p>' . $this->t('This page contains examples of various content elements described using render arrays. Read the code and comments in \Drupal\render_example\Controller\RenderExampleController::arrays() for more information.') . '</p>',
      '#description' => $this->t('Example of using #markup'),
    ];

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.

  • valthebald committed 8ecc470 on 8.x-1.x
    Issue #3103583 by jungle,valthebald: Fix deprecation notices of...
valthebald’s picture

Status: Needs review » Fixed

Committed to 8.x-1.x, thank you!

Status: Fixed » Closed (fixed)

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