[2.0.0-rc1] better handling of HTML classes deprecation

Created on 24 December 2024, 29 days ago

From @Grimreaper

So, about "'HTML classes' source is deprecated in favor of 'Attributes'.". The problem is https://git.drupalcode.org/project/ui_patterns/-/blob/2.0.x/src/Plugin/U...

  /**
   * {@inheritdoc}
   */
  public function getPropValue(): mixed {
    // @phpstan-ignore-next-line
    \Drupal::messenger()->addWarning("'HTML classes' source is deprecated in favor of 'Attributes'.");
    return parent::getPropValue();
  }

Messenger is called in getPropValue so when a component is displayed it is triggered. That's why it was displayed when just going on a layout builder page (not form).

I think it would be better to override the constructor and use Drupal API to mark a deprecation.

So it will be logged and detected by tools like rector and/or phpstan

From @pdureau

Also, add (Deprecated) in plugin label

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France pdureau Paris

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