https://www.drupal.org/pift-ci-job/2029406

Render callbacks must be a closure or implement TrustedCallbackInterface or RenderElementInterface.

  3x: 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\rate\RateEntityVoteWidget::buildRateVotingWidget. 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
    3x in ViewsFilterTest::testFilterMin from Drupal\Tests\rate\Functional\ViewsFilterTest.php

See https://git.drupalcode.org/project/rate/-/blob/8.x-1.x/src/Plugin/views/...

public function render(ResultRow $values) {
  $entity = $this->getEntity($values);
  $widget = [];

  if ($entity) {
    $widget = [
      '#lazy_builder' => ['rate.entity.vote_widget:buildRateVotingWidget',
        [
          $entity->id(),
          $entity->getEntityType()->id(),
          $entity->bundle(),
          $this->options['widget_type'],
        ],
      ],
      '#create_placeholder' => TRUE,
    ];
  }

  return $widget;
}

Comments

tomvanetten created an issue. See original summary.

tomvanetten’s picture

StatusFileSize
new5.21 KB

Fixed drush_print by recommended output()->println()
Fixed drupal_set_message() by using \MessengerInterface::addMessage()
Fixed entity_get_display() by Drupal::service('entity_display.repository')->getViewDisplay()
added Add core_version_requirement: ^8 || ^9 to rate.info.yml

tomvanetten’s picture

Status: Active » Needs review
lamp5’s picture

Status: Needs review » Needs work
tomvanetten’s picture

StatusFileSize
new5.39 KB
tomvanetten’s picture

StatusFileSize
new5.37 KB

Create a new enitity on the new way

tomvanetten’s picture

Status: Needs work » Needs review
tomvanetten’s picture

krzysztof domański’s picture

Status: Needs review » Needs work
Issue tags: +Drupal 9 compatibility

@tomvanetten Thank you for a contribution on Rate.

Here are additional issues for this:

#3074633: Replace deprecated entity_get_display()
#3073450: Replace deprecated drupal_set_message() with \Drupal::messenger()

-enzo-’s picture

Hi @Krzysztof Domański & @tomvanetten

I did a re-roll, because patch #6, have some issues with src/RateBotDetector.php becuase the branch 8.x-1.x already have those changes.

After more those change I ran drupal-check again and got this results.

 35/35 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ --------------------------------------------------------------------------------------
  Line   src/Plugin/VoteResultFunction/CountUp.php
 ------ --------------------------------------------------------------------------------------
         Class Drupal\votingapi\VoteResultFunctionBase not found and could not be autoloaded.
 ------ --------------------------------------------------------------------------------------

But after downloading the Votinapi module, the errors were solved.

Please review and let me know if we are good for Drupal9

-enzo-’s picture

Status: Needs work » Needs review
krzysztof domański’s picture

Assigned: tomvanetten » Unassigned
Issue tags: +Needs followup
StatusFileSize
new300 bytes

1. Let's add a separate problem for Drush deprecation. Also we can bump the minimum required version to 9.
https://docs.drush.org/en/latest/install/#drupal-compatibility

composer.json

+    "extra": {
+        "drush": {
+            "services": {
+                "drush.services.yml": "^9 || ^10"
+            }
+        }
+    }

2. Should be method_exists instead offunction_exists. Do we need a condition here when we bump the minimal version of Drush?

-  if (function_exists('writeln')) {
+  if (method_exists($this->output(), 'writeln')) {
krzysztof domański’s picture

StatusFileSize
new301 bytes
krzysztof domański’s picture

StatusFileSize
new780 bytes
krzysztof domański’s picture

StatusFileSize
new4.61 KB
krzysztof domański’s picture

1) Drupal\Tests\rate\Functional\NodeFivestarWidgetTest::testVoting
Exception: Warning: time() expects exactly 0 parameters, 2 given
Drupal\Core\Field\BaseFieldDefinition->getDefaultValue()() (Line: 469)

This is a problem in Voiting API module on PHP 7.3. It has been fixed already but only in the dev version.
#3048085: time() is used as a callback, and I'm assuming it's php7.3 that doesn't like time having parameters.

krzysztof domański’s picture

Status: Needs review » Needs work

One more deprecated code Render callbacks must be a closure or implement TrustedCallbackInterface or RenderElementInterface.

  3x: 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\rate\RateEntityVoteWidget::buildRateVotingWidget. 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
    3x in ViewsFilterTest::testFilterMin from Drupal\Tests\rate\Functional\ViewsFilterTest.php

See https://git.drupalcode.org/project/rate/-/blob/8.x-1.x/src/Plugin/views/...

public function render(ResultRow $values) {
  $entity = $this->getEntity($values);
  $widget = [];

  if ($entity) {
    $widget = [
      '#lazy_builder' => ['rate.entity.vote_widget:buildRateVotingWidget',
        [
          $entity->id(),
          $entity->getEntityType()->id(),
          $entity->bundle(),
          $this->options['widget_type'],
        ],
      ],
      '#create_placeholder' => TRUE,
    ];
  }

  return $widget;
}
manish_tapadar’s picture

StatusFileSize
new1.04 KB

For #lazy_builder callbacks must be methods of a class that implements TrustedCallbackInterface we need to upload this patch as well

krzysztof domański’s picture

Issue tags: +Needs reroll

Needs a re-roll.

kapilv’s picture

Assigned: Unassigned » kapilv
krzysztof domański’s picture

Issue summary: View changes
kapilv’s picture

Assigned: kapilv » Unassigned
Status: Needs work » Needs review
StatusFileSize
new895 bytes

Hean a re-roll patch.

jeroent’s picture

This module now has a Drupal 9 release, so I guess we can close this issue?

krzysztof domański’s picture

ivnish’s picture

Status: Needs review » Fixed
Issue tags: -Drupal 9 compatibility, -Needs followup, -Needs reroll

Yes, I think this issue can be closed. Code style issues will be fixed in another issues

Status: Fixed » Closed (fixed)

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