Problem/Motivation
The method getPlugins in the Lazy Service is defined as static, but is called from the Service Object in the LazyForm, rather than the Lazy namespace.
$plugins = array_keys($this->lazyLoad::getPlugins());
Proposed resolution
It should be rather be defined not static, as Drupal 8 OOP best practice, and called appropriatley in the LazyForm, such as:
$plugins = array_keys($this->lazyLoad->getPlugins());
or called just from the Lazy namespace such as Lazy::getPlugins()),
but in this case it would make it incoherent the use of the Lazy service in the LazyForm and compromise the Unit testability of the 'buildForm' method (bad practice to inject static methods in not static ones)
Comments
Comment #2
itamair commentedComment #3
itamair commentedThe attached patch implements the approach that would personally prefer and I feel to suggest ...
Comment #6
osmanThanks for the patch italo