diff --git a/contextual_links_example/src/Entity/CLEEntity.php b/contextual_links_example/src/Entity/CLEEntity.php index 090b8a0..0ff8599 100644 --- a/contextual_links_example/src/Entity/CLEEntity.php +++ b/contextual_links_example/src/Entity/CLEEntity.php @@ -3,6 +3,7 @@ namespace Drupal\contextual_links_example\Entity; use Drupal\Core\Entity\Entity; +use Drupal\Core\StringTranslation\StringTranslationTrait; /** * A simple entity for usage of contextual links assigned to an object. @@ -21,6 +22,8 @@ use Drupal\Core\Entity\Entity; */ class CLEEntity extends Entity { + use StringTranslationTrait; + /** * Creates a renderable array containing the body of the entity. * @@ -29,7 +32,7 @@ class CLEEntity extends Entity { */ public function bodyContent() { return [ - '#markup' => t('This is the content of example object @id.', ['@id' => $this->id()]), + '#markup' => $this->t('This is the content of example object @id.', ['@id' => $this->id()]), ]; } @@ -41,7 +44,7 @@ class CLEEntity extends Entity { */ public function titleContent() { return [ - '#markup' => t('Title for example object @id', ['@id' => $this->id()]), + '#markup' => $this->t('Title for example object @id', ['@id' => $this->id()]), ]; }