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, Ed, biapar, Willr, Ingo, swaiba

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

Go to End



Community Member, 607 Posts

26 September 2009 at 2:44pm

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)) {

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?