Add suggestion for using the '#config_target' render array key

Created on 9 February 2025, about 2 months ago

Problem/Motivation

In the lights of configuration forms starting from 10.4.0 / 11.0.0, now warn users if a value of the configuration entity they are related to is being overridden (see the change record ), we might want to consider popularizing the necessary #config_target render array key as a suggestion of Drupal Practice.

Unfortunately, I'm not deeply familiar with the details of how PHPCS rules are supposed to be defined. Still, I think it could be a rather simple condition: IF the class extends ConfigFormBase → THEN check whether the #config_target attribute is present in the buildForm() method. (Of course, there are always exceptions (example) but we can still cover the 99% of cases by tieing the rule to the buildForm() method.)

I have searched the issue queue here on Drupal.org and in the code repository on GitHub for similar mention with no luck.

Any thoughts?

Feature request
Status

Active

Version

8.3

Component

Review/Rules

Created by

🇭🇺Hungary Balu Ertl Budapest 🇪🇺

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

Comments & Activities

Production build 0.71.5 2024