Problem/Motivation

Keep using service ID as class namespace for autowiring.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

grimreaper created an issue. See original summary.

grimreaper’s picture

Assigned: grimreaper » just_like_good_vibes
Status: Active » Needs review

just_like_good_vibes made their first commit to this issue’s fork.

just_like_good_vibes’s picture

Thanks @grimreaper.
i have worked on second MR that started on yours : your 3 commits are kept as they are, with small commits on top.

Kept from your MR, and why:
- We ask for our manager by its class, Drupal\ui_patterns\ComponentPluginManager. A service named by its class works with autowiring and needs no alias.
- plugin.manager.ui_patterns_component service ID is removed. It was never released, only currently on dev branch, so nobody uses it. we don't need, you are right.
- ui_patterns_ckeditor5.host_entity service ID is removed. Despite being already recently released, we in fact don't need it and bet nobody started to build on it.
- The deprecation note on the decoration of plugin.manager.sdc is removed. I first put it back, then removed it again: without the decoration, on a site without Canvas, rendering fails. Core checks the props against a schema where the ui-patterns:// references are not resolved. So we still need the decoration.
- The autowiring in ui_patterns_ckeditor5, the .gitattributes update and the test fixes.

Dropped from your MR: nothing.

Added on top, and why:
- Where the code needs our class, it now asks for our class, so no more instanceof, @var or phpstan ignore. These checks were always true, and if one was false we would lose features without any error (empty list of components, missing dependencies).
- Two injections of the manager that were never used are removed.
- Some tests asked plugin.manager.sdc for what ui_patterns adds. They now ask our service, so they also pass with Canvas.

The rules behind:
- A new service uses its class name as ID.
- Use plugin.manager.sdc when you only need core data. Use Drupal\ui_patterns\ComponentPluginManager when you need what ui_patterns adds, or when your feature takes its list of components from it.
- If our class is need, we ask for our class.

Tested locally: all kernel and functional tests, on a normal site and with Canvas too. The kernel tests also ran with other modules that decorate plugin.manager.sdc and add components.

  • grimreaper committed f4dbe15d on 2.0.x
    task: #3628421 Keep service ID declared with namespace.
    
    - Update...
grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Needs review » Fixed

Thanks, good for me, merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.