Jump to:

22999 Posts in 11854 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Manage extensions in yaml

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

Page: 1
Go to End
Author Topic: 332 Views
  • martimiz
    Avatar
    Forum Moderator
    1038 Posts

    Manage extensions in yaml Link to this post

    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?

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Manage extensions in yaml Link to this post

    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.

  • martimiz
    Avatar
    Forum Moderator
    1038 Posts

    Re: Manage extensions in yaml Link to this post

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

    Martine

    332 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.