drupal-code-generator icon indicating copy to clipboard operation
drupal-code-generator copied to clipboard

Add a command to generate plugin deriver

Open bhanu951 opened this issue 1 year ago • 3 comments

Please add a command to generate plugin derivative extending DeriverBase class.

Currently there is no command to generate plugin derivative.

Hence we need to code same boilerplate code again and again. Please Create a generator class to generate plugin derivative.

bhanu951 avatar Apr 24 '24 08:04 bhanu951

I presume If you want to extend DeriverBase then you want to generate a deriver and not a derivative. Especially because while I added support for plugin classes to define themselves as derivatives, it doesn't need generator support as those are just plugin classes with a special id. So I took the liberty to retitle the issue.

I guess it's worth doing it if we allow injecting dependencies, looking at ContainerDerivativeDiscoveryDecorator there's a special ContainerDeriverInterface to support that.

We could start it as a copy of the controller which has very similar semantics.

chx avatar Apr 19 '25 17:04 chx

@chx Thanks for looking into it. What I meant was to have a command to generate something similar to this

bhanu951 avatar May 08 '25 05:05 bhanu951

Yes, indeed that's a deriver. I note the inconsistent naming in core, if you look at deriver classes you will find 34 which are called deriver and 47 which is called a derivative. Meanwhile the base class is DeriverBase and the interface is DeriverInterface so they are all derivers. What a mess.

chx avatar May 08 '25 06:05 chx