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.
I hope this has been informative, I must do work now :P
you may need a capital W to match the setter function if you do that way.
There are other ways to do this with injector, via property setters, or public properties.
- public $width
You can use injector to set this property after it has created the object. OR
- private $width;
- public function setWidth($width)
- $this->width = $width;
Both of these can be set via
- width: 80
(be aware I've stripped the namespaces for brevity)
Arguably the docs are actually better in the class itself 😂 :P https://github.com/silverstripe/silverstripe-framework/blob/4.4.4/src/Core/Injector/Injector.php#L18-L131
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.