Don't pass config through t()

Created on 9 July 2025, 5 days ago

Problem/Motivation

Hey, I noticed that PHPCS is warning us...

FILE: src/Hook/FormHooks.php
------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
 90 | WARNING | Only string literals should be passed to t() where possible
    |         | (Drupal.Semantics.FunctionT.NotLiteralString)

This comes from

$this->messenger->addWarning($this->t($config->get('warning_message')));

config_warning.settings:warning_message is already translatable per its schema, so I think you should be fine just displaying it directly.

Thanks!

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom AndyF

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024