If you have some scheduled content, when you try to access to the 'admin/config/content/scheduler/list' page, it crashes with this error message :

Fatal error: Call to undefined method Drupal\Component\Utility\SafeMarkup::set() in /www/modules/contrib/scheduler/src/Controller/SchedulerController.php on line 102

Tested with both 8.x and 2423449 branch.

CommentFileSizeAuthor
#2 edit_issue_scheduled-2572049-1.patch1.95 KBhaza

Comments

Haza created an issue. See original summary.

haza’s picture

StatusFileSize
new1.95 KB

According to #2296163: Twig autoescape enabled and text sanitization APIs updated, escaping is now handled by Twig. That means we can now remove the SafeMarkup calls.

Patch attached. It also updates the way the operations are built.

haza’s picture

Status: Active » Needs review

  • pfrenssen committed 0ec4301 on 8.x-1.x authored by Haza
    Issue #2572049 by Haza, pfrenssen: Replace SafeMarkup::set() with a...
pfrenssen’s picture

  1. +++ b/src/Controller/SchedulerController.php
    @@ -90,21 +90,32 @@ class SchedulerController extends ControllerBase {
    -      $ops = [
    -        \Drupal::l(t('edit'), Url::fromRoute('entity.node.edit_form', ['node' => $node->id()], ['query' => $destination])),
    -        \Drupal::l(t('delete'), Url::fromRoute('entity.node.delete_form', ['node' => $node->id()], ['query' => $destination])),
    +      $ops = [];
    +      $ops['edit'] = [
    +        'title' => t('Edit'),
    +        'url' => Url::fromRoute('entity.node.edit_form', ['node' => $node->id()], ['query' => $destination]),
    +      ];
    +      $ops['delete'] = [
    +        'title' => t('Delete'),
    +        'url' => Url::fromRoute('entity.node.delete_form', ['node' => $node->id()], ['query' => $destination]),
           ];
    

    Great to see this being reworked into a render array. We can put it directly in the $row now.

  2. +++ b/src/Controller/SchedulerController.php
    @@ -90,21 +90,32 @@ class SchedulerController extends ControllerBase {
    -        SafeMarkup::checkPlain($node->type->entity->label()),
    -        SafeMarkup::set($this->renderer->render($username)),
    

    Now that the calls to SafeMarkup are removed, we can also remove the use statement in the header.

pfrenssen’s picture

Status: Needs review » Fixed

Addressed the remarks and merged in 8.x-1.x. Thanks a lot @Haza!

Status: Fixed » Closed (fixed)

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