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


Go to End
Reply


3 Posts   653 Views

Avatar
martimiz

Forum Moderator, 1169 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, 1169 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