Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC replaces directive to completely disable and replace another yml block #32

Open
tractorcow opened this issue Apr 17, 2018 · 2 comments

Comments

@tractorcow
Copy link

tractorcow commented Apr 17, 2018

Given this config

---
Name: somecoreconfig
---
SomeClass:
  extensions:
    - SomeExtension
---
Name: myconfig
replaces: '#somecoreconfig'
---
SomeClass:
  extensions:
    - AnotherExtension

The "merged" config would only contain

SomeClass:
  extensions:
    - AnotherExtension

This would work similarly to before and after, but would only work with a single named block #somename.

Other blocks that are before / after the named block would not break, but the replacement would be substituted in place of the original in the original position.

You cannot use replaces with before / after

@micobarac
Copy link

This use case covers disabling extension defined by the original configuration.
To replace class name by another and attach it to the extension, the configuration should go in two steps:

  • disable extension for class set by original extension configuration *.yml file
  • enable the same extension for another class, other than the original one

It would be ideal to do this in the same custom /mysite/_config/*.yml file.

@tractorcow
Copy link
Author

tractorcow commented Apr 17, 2018

Yes, so in your case the usage would be:

---
Name: mycomments
replaces: '#commentssitetree'
---
SilverStripe\Blog\BlogPage:
  extensions:
    - SilverStripe\Comments\Extensions\CommentsExtension
  comments:
    enabled_cms: true

(assuming we implement this feature)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants