Skip to content

Commit

Permalink
Bugfix for #4174. (#4192)
Browse files Browse the repository at this point in the history
When the class itself is implementing ContainerFactoryPluginInterface, we do not have a parent create method we can use.
  • Loading branch information
GueGuerreiro authored and enzolutions committed Nov 11, 2019
1 parent 232d479 commit 3c59d0b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion templates/module/src/Plugin/Block/block.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class {{class_name}} extends BlockBase {% if services is not empty %}implements
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
$instance = new static($configuration, $plugin_id, $plugin_definition);
{{ serviceClassInjectionNoOverride(services) }}
return $instance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class {{ class_name }} extends ImageFormatterBase implements ContainerFactoryPlu
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
$instance = new static($configuration, $plugin_id, $plugin_definition);
$instance->currentUser = $container->get('current_user');
$instance->linkGenerator = $container->get('link_generator');
$instance->imageStyleStorage = $container->get('entity_type.manager')->getStorage('image_style');
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/Plugin/Mail/mail.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class {{class_name}} extends PhpMail {% if services is not empty %}implements Co
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
$instance = new static($configuration, $plugin_id, $plugin_definition);
{{ serviceClassInjectionNoOverride(services) }}
return $instance;
}
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/Plugin/skeleton.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class {{class_name}} implements {% if plugin_interface is not empty %}{{ plugin_
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
$instance = new static($configuration, $plugin_id, $plugin_definition);
{{ serviceClassInjectionNoOverride(services) }}
return $instance;
}
Expand Down

0 comments on commit 3c59d0b

Please sign in to comment.