Support dependency injection for Translator plugins UI class

Created on 16 December 2024, 4 months ago

Problem/Motivation

Translator plugins can provide a UI class. However, the UI class cannot be instantiated with dependency injection. This makes mocking more difficult.

Proposed resolution

Support dependency injection for Translator plugins UI class

Remaining tasks

  1. Write a merge request
  2. Review
  3. Commit

User interface changes

None

API changes

Translator plugins UI classes can be instantiated with dependency injection

Data model changes

None

📌 Task
Status

Active

Version

1.0

Component

Core

Created by

🇳🇱Netherlands idebr

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

Comments & Activities

  • Issue created by @idebr
  • 🇨🇭Switzerland berdir Switzerland

    UI classes are a relic from the Drupal 7 ctools plugin system this is originally based on. I think the most feasible way forward instead of more workaround is to just deprecate UI classes and inline them into the main plugin class. In some cases, that will result in large classes, but this is the common approach for plugins, from blocks to field types, they both manage the data and their settings forms.

    We could deprecate that in 8.x-1.x, and allow plugin classes to directly implement the UI interface and in a future 2.x branch, merge and require it.

Production build 0.71.5 2024