Refactor module to use a dedicated service, batch, & helper trait

Created on 4 September 2024, 4 months ago

Problem/Motivation

Currently, this module is a bit tightly coupled, and it's unfortunately not possible to programmatically convert bundles.

Proposed resolution

It'd be nice to see some refactoring of this module to be more in line with Drupal APIs and to break out functionality into reusable "components". For example, this module could benefit from providing a service handler which can be used to programmatically convert bundles instead of having to do it manually in an UI.

Also, it'd be cool with a Batch class that utilises this service handler which in turn can be used in the form. The service handler should be responsible for actually converting the bundles and leave as much of that logic out of the form. However, not everything fits in a service handler. Some utility/helper methods could be moved to a trait/helper class to promote reusability.

Remaining tasks

[] Create PR with example

API changes

- New service handler which can be used anywhere
- Existing Batch operations/finish callbacks moved to separate Batch class
- Utility/helper trait to hold some of the reusable methods previously found in the ConvertBundles class

πŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden erikbrgn

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

Merge Requests

Comments & Activities

  • Issue created by @erikbrgn
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Hi @erikbrgn, this looks like you have done fantastic work here! If I have more time to understand your plan perhaps we make a 3.0.x-dev branch and put your changes into there, since I do not want to break the 2.0.x-dev branch.

    This way, we can pump out all the 3.x alphas we want until we're happy with it and we put a beta tag on it.

    Meanwhile, we have to move forward with Drupal 11 compatibility on the 2.0.x-dev branch and a future 3.0.x-dev branch so there may be some work to do in rerolling this merge request at some point!

Production build 0.71.5 2024