\Drupal calls should be avoided in classes, use dependency injection instead.
see src/Plugin/Field/FieldFormatter/EnhancedButtonFormatter.php

$link_title = \Drupal::token()->replace($item->title, [$entity->getEntityTypeId() => $entity], ['clear' => TRUE]);

Comments

alunyov created an issue. See original summary.

alunyov’s picture

Created patch. Please check.

alunyov’s picture

Status: Needs work » Needs review
rksyravi’s picture

Status: Needs review » Reviewed & tested by the community

Hi @alunyov,

The above #2 patch works great for me. Going for RTBC.

metaaa’s picture

The patch works as desired.

igergg’s picture

Tested the patch, works as expected.

  • alunyov authored 26e3d37 on 8.x-1.x
    Merge pull request #3 from olunov/drupal-9-checks
    
    Issue #3111891 by...
  • alunyov committed 95cb2fe on 8.x-1.x
    Issue #3111891 by alunyov, rksyravi, metaaa, igergg: Remove \Drupal call...
alunyov’s picture

Status: Reviewed & tested by the community » Fixed

Fixed was applied and pushed to repo

alunyov’s picture

Status: Fixed » Closed (fixed)