Support config actions for using config split with Drupal recipes

Created on 9 October 2024, 6 months ago

Problem/Motivation

With Drupal recipes it is possible to automate site building actions. Config Splits are also created configured through admin UI and this can be automated with recipes. The only problem that config_split entity doesn't provide any action methods, so that it would be easy to change split configuration.

Proposed resolution

Add methods to ConfigSplit entity class and expose them as action methods. The following methods are proposed:

  1. addModule
  2. removeModule
  3. addTheme
  4. removeTheme
  5. addToCompleteList
  6. removeFromCompleteList
  7. addToPartialList
  8. removeFromPartialList

Maybe the other properties can be also set with action methods, but they are more "system" properties and are not likely to be changed, as changing storage or folder can lead to unexpected behavior.

Remaining tasks

Add new methods.

User interface changes

None

API changes

None

Data model changes

None

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany a.dmitriiev

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

Merge Requests

Comments & Activities

  • Issue created by @a.dmitriiev
  • Pipeline finished with Success
    6 months ago
    Total: 254s
    #305077
  • 🇩🇪Germany a.dmitriiev

    Uploading patch to reference in composer.json

  • 🇨🇭Switzerland bircher 🇨🇿

    Thanks for the issue and thanks for the patch! i was thinking about adding some config actions during Drupalcon Barcelona, but then I didn't really know what would be useful and I am not sure just adding things for the sake of adding things is the right thing to do.

    I think we shouldn't add actions for themes until Multisite setup ignore theme Needs work in other words until themes actually can be split.

    Then I have some reservations for the names of adding and removing from the lists, in particular how that works with plurals, for modules addModule becomes addModules but addToCompleteList would become addToCompleteLists and that seems awkward, but I don't know what would be better.

    And finally for addModule, I don't know if setting the module weight to 0 is a good enough solution or if we should allow setting the weight or if we should check the installed modules and set a weight based on that if it is available.

    And lastly of course it would be great to have a test that runs these actions by means of applying a test recipe.

  • 🇩🇪Germany a.dmitriiev

    It is possible to control the plural form of the method name that will be a config action with pluralize attribute.

    I think for addToCompleteList the plural one should be addToCompleteListMultiple ? That would be the most obvious, what do you think?

    As for the themes, if it is not ready yet, let's remove it for now, of course.

    Regarding the module weight, you are right, let's allow to set the weight as well.

  • Pipeline finished with Success
    6 months ago
    Total: 205s
    #305946
  • 🇩🇪Germany a.dmitriiev

    I have removed theme methods, added plural forms for addToCompleteList, removeFromCompleteList, addToPartialList and to removeFromPartialList. Also it is now possible to pass the module weight in addModule method.

    Regarding the tests, I heard that recipe initiative is working on some test template, I will try to check, but I am not sure what kind of test it will be.

Production build 0.71.5 2024