View more context

 

nightjarnz

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

Show 1 attachment(s)
GitHub  
silverstripe/silverstripe-framework

SilverStripe Framework, the MVC framework that powers SilverStripe CMS - silverstripe/silverstripe-framework

Hide attachment content
nightjarnz

There are other ways to do this with injector, via property setters, or public properties.

  1. public $width

You can use injector to set this property after it has created the object. OR

  1. private $width;
  2. public function setWidth($width)
  3. {
  4. $this->width = $width;
  5. }

Both of these can be set via

  1. Injector:
  2. YourClass:
  3. properties:
  4. width: 80

(be aware I've stripped the namespaces for brevity)

nightjarnz

you may need a capital W to match the setter function if you do that way.

nightjarnz

I hope this has been informative, I must do work now :P

Conan

Howdy 👋 Do any of you know if there is a SS4 equivalent method for SS3's (framework) JSONDataFormatter->convertDataObjectSet? (Converting SS3 module to SS4)

Neil Creagh

I just posted this question on the Silverstripe forum (about setting number of items pagination in Gridfield). If anyone can point me in the right direction for this that would be great: https://forum.silverstripe.org/t/girdfield-pagination-on-v4-x/2348

Show 1 attachment(s)
Silverstripe Forum  
Girdfield pagination on v4.x

Silverstripe Version 4.4.4 Question: I’m having trouble setting the number of items per page on a Gridfield list in v4 Previously (v3) I would have done it like this: $gridFieldConfig->getComponentByType('GridFieldPaginator')->setItemsPerPage(50); I’ve added these two namespaces use SilverStripe\Forms\GridField\GridFieldConfig; use SilverStripe\Forms\GridField\GridFieldPaginator; but I get “Uncaught Error: Call to a member function setItemsPerPage() on null” Can anyone point me in ...

Hide attachment content
Mo

Try changing to GridFieldPaginator::class?

👍 (1)