Replace t() with $this->t() in all plugins

Created on 16 December 2020, almost 4 years ago
Updated 23 February 2023, almost 2 years ago

Problem/Motivation

When attempting to unit test a widget which extends the StringTextfieldWidget the traditional method of mocking the string translation service fails and an error is produced Call to undefined function Drupal\Core\Field\Plugin\Field\FieldWidget\t().

Proposed resolution

PluginBase is using StringTranslationTrait but many of the child plugins are not utilizing it properly. Use $this->t() instead of t() for string translation calls for all classes extending PluginBase.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

RTBC

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine novchuk.v

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.

  • First commit to issue fork.
  • @urvashi_vora opened merge request.
Production build 0.71.5 2024