Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Custom Module - Adding global settings to /module/_config.php

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: 892 Views
  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Custom Module - Adding global settings to /module/_config.php Link to this post

    Hi ya

    I'm working on a custom registration module, and I would like to set it up so it's own _config.php is the single point of call for configuring the module for things like form fields etc.

    For instance, on the registration form, I have a password and confirm password field. When there is a registration error, I also have the form being re-populated with submitted data.

    if(is_array($data)) {
       $form->loadDataFrom($data);
    }

    However i don't want this to happen for the password fields. I want them to always be blank.

    So I figured I would just unset these two fields from the $data array - simple.

    But I would rather have the name of these fields in a central location like _config.php to make things easier for future projects.

    My question is, how do I give any of my custom objects and controllers access to any declared variable in the _config.php file? I have tried "global" as per the main _config.php and lang files, but I get undefined notices, so it's no good.

    Any ideas?
    Aaron

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