Commit c04fc4d0 authored by Harsh Panchal's avatar Harsh Panchal Committed by Ahmad Abbad
Browse files

Issue #3305894 by Harsh panchal, BramDriesen: t() calls should be avoided in...

Issue #3305894 by Harsh panchal, BramDriesen: t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
parent 4904126a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Drupal\Core\Cache\Cache;
use Drupal\Core\Render\Markup;
use Drupal\Core\Url;
use Drupal\Core\Link;
use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
 * Provides a Gleab block.
@@ -17,6 +18,7 @@ use Drupal\Core\Link;
 */
class GleabBlock extends BlockBase {

  use StringTranslationTrait;
  /**
   * {@inheritdoc}
   */
@@ -25,9 +27,9 @@ class GleabBlock extends BlockBase {
    if (empty($config->get('gleab_api_key'))) {
      if (\Drupal::currentUser()->hasPermission('administer gleab')) {
        $url = Url::fromUri('route:gleab_configuration');
        $link = new Link(t('here'), $url);
        $link = new Link($this->t('here'), $url);
        $link = $link->toString()->getGeneratedLink();
        \Drupal::messenger()->addError(Markup::create(t('Please fill out the Gleap API key from') . " " . $link));
        \Drupal::messenger()->addError(Markup::create($this->t('Please fill out the Gleap API key from') . " " . $link));
      }
      return;
    }