Message of the day:
Security release 4.4.4 is out. Changelog: https://github.com/silverstripe/silverstripe-framework/blob/4/docs/en/04_Changelogs/4.4.4.md
SilverStripe 4 related information and questions.
You can read more about the power of injector here: https://docs.silverstripe.org/en/4/developer_guides/extending/injector/
otherwise you'll need to call
new YourClass($widthParameter) as with normal PHP.
but if you do the above, you MUST instantiate all your classes with
where the constructor looks like
__construct($width) you can use
- width: 40
use Injector to do this
OR in a cheeky combination of the second point I made above
ok, so there are 2 ways of achieving this :P one is to change e.g.
- function __construct()
- $width = self::config()->get('width');
to instead be more like:
- function __construct($width = null)
- $width = $width ?: self::config()->get('width');
This way you can create objects in PHP without messing around withe the global configuration (if one should ever need to). Plus the internal object state is less magic.
@Firesphere I am overriding userform templates in my module for which I had to add Before: #module-other