Support registering bundle classes outside of autodiscovery

Created on 1 April 2025, 4 days ago

Problem/Motivation

We're experimenting with different distribution methods and would like to define bundle classes outside of the traditional module system. Such as with libraries/vendor.

The ideal implementation is similar to Add parameter to register lists outside of autodiscovery Active , where a parameter is available.

We don't expect to be instructing people to override parameters in YAML, instead it'd be automated by a glue module in a compiler pass or similar.

Proposed resolution

Discover attributes on manual lists of bundle class class-string references.

Remaining tasks

Decide if this is where the code should live or should it be something in the plugin manager??

User interface changes

Nil

API changes

New service parameter.

Data model changes

Nil.

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇦🇺Australia dpi Perth, Australia

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

Merge Requests

Comments & Activities

  • Issue created by @dpi
  • Merge request !19Draft: Resolve #3516569 "Bca bundle param" → (Open) created by dpi
  • 🇦🇺Australia dpi Perth, Australia
  • 🇦🇺Australia dpi Perth, Australia

    Tests can be arranged if we can agree on implementation/direction.

  • Pipeline finished with Success
    4 days ago
    Total: 390s
    #462086
  • Pipeline finished with Success
    4 days ago
    Total: 204s
    #462092
  • Pipeline finished with Success
    4 days ago
    Total: 141s
    #462095
  • Pipeline finished with Success
    4 days ago
    Total: 257s
    #462097
  • 🇦🇺Australia mstrelan

    Wondering if this can be incorporated in to the core MR which now does its own discovery outside of plugins - https://git.drupalcode.org/project/drupal/-/merge_requests/11545

    In its current state it searches for an Entity subdir in all container.namespaces. Would be worth seeing if it can be made to work with this use case.

  • 🇦🇺Australia dpi Perth, Australia

    container.namespaces includes only Drupal extensions.

    The desire for this issue is to include classes defined in vendor.

  • 🇦🇺Australia mstrelan

    Is there a way we can refactor the core MR to do this? E.g. maybe CoreServiceProvider passes a container param with some hints of where to scan, the custom module can modify the container param and then the BundleClassCollectorPass can find them.

  • 🇦🇺Australia dpi Perth, Australia

    Theres been discussions of if or how to scan vendor for plugins before, I dont have references on hand.

    I think core would want to look at composer autoload namespace and directories and scan them; whereas the change here is a simple list of which classes to include. No directory scans.

    For selfish reasons I dont really have time on hand to look through core, as this is very much a side thing of what I'm working on for PNX. I'd prefer a quick merge but otherwise will advise to use a patch in the meantime.

  • 🇦🇺Australia dpi Perth, Australia

    We'll do it outside of BCA for now, but may revisit due to need for a flexible weighting system.

Production build 0.71.5 2024