t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead

Created on 10 March 2021, about 4 years ago
Updated 4 February 2023, about 2 years ago

Problem/Motivation

After running coder for Drupal best practices, found the following issues regarding t() calls:

$ phpcs --standard=DrupalPractice .

FILE: /menu_block_settings_override/src/Plugin/Field/FieldWidget/MenuBlockSettingsOverrideWidget.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------
 116 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 121 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 155 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead

Proposed resolution

Need to replace t() calls with $this->t() wherever required.

User interface changes

NONE

API changes

NONE

Data model changes

NONE

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia ankithashetty Karnataka, India

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024