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.

General Questions

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

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

Manage extensions in yaml


Reply

3 Posts   470 Views

Avatar
martimiz

3 August 2013 at 2:31am Forum Moderator, 1091 Posts

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

5 August 2013 at 11:34am (Last edited: 5 August 2013 11:37am), Forum Moderator, 921 Posts

The config system is designed to not include values in certain circumstances, e.g. if you check the [url=http://doc.silverstripe.org/framework/en/topics/configuration]docs on config[/url] 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

7 August 2013 at 11:17pm Forum Moderator, 1091 Posts

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

Martine