Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Manage extensions in yaml


Go to End


3 Posts   2461 Views

Avatar
martimiz

Forum Moderator, 1391 Posts

3 August 2013 at 2:31am

I know extensions should be set in yaml like this:

Classname:
  extensions:
    ['myExtension']

But is there a way to replace an extension with another one or remove it in yaml as well? or do we need to go back to the old _config.php and do:

Classname::remove_extension('oldExtension');

And if not - could some 'remove-extension' key be added, and then use before/after to force some extensions to not be loaded?

Avatar
Sean

Forum Moderator, 922 Posts

5 August 2013 at 11:34am

Edited: 05/08/2013 11:37am

The config system is designed to not include values in certain circumstances, e.g. if you check the docs on config it mentions the use of "Only", "classexists", "moduleexists" etc, which might work for you.

Unit tests still in the core use remove_extension() so that's probably alright to use for the time being, e.g. Member::remove_extension('MyMemberExtension') for 3.1 syntax, and Object::remove_extension('Member', 'MyMemberExtension') for 3.0 syntax. You can also manipulate the Config class directly, e.g. Config::inst()->remove('Member', 'extensions', Config::anything(), 'MyMemberExtension')

If this function gets deprecated that'll be a later release of the framework.

Avatar
martimiz

Forum Moderator, 1391 Posts

7 August 2013 at 11:17pm

Thanks Sean, I'll read the docs again - I'm getting better at working YAML, but it still doen't come naturally somehow :)

Martine