Jump to:

23483 Posts in 18976 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Test for presence of module or fields

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: 815 Views
  • vwd
    Avatar
    Community Member
    158 Posts

    Test for presence of module or fields Link to this post

    Hi,

    Is there a conventional way of testing for the presence of Module or specific fields that a module might create?

    Thanks very much.

    VWD.

  • Howard
    Avatar
    Community Member
    215 Posts

    Re: Test for presence of module or fields Link to this post

    You can check if a class exists by doing this:

    if (class_exists('MyClass')) {
    $myclass = new MyClass();
    }


    So you could check for a known class in the module and then assume that the module is installed - maybe not ideal...

  • vwd
    Avatar
    Community Member
    158 Posts

    Re: Test for presence of module or fields Link to this post

    Thanks @Howard, that'll do the trick.

    So there isn't a Sapphire API to test for the presence of a module or widget?

    Thanks again.

    VWD

    815 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.