From 5d19dd447db13d06ca4fe6f8cdb6df709fc53864 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Mon, 28 Oct 2024 15:12:43 +0100 Subject: [PATCH 1/2] ITKDev: Update create method --- src/Plugin/os2web/DataLookup/DataLookupBase.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Plugin/os2web/DataLookup/DataLookupBase.php b/src/Plugin/os2web/DataLookup/DataLookupBase.php index 2087814..bd40653 100644 --- a/src/Plugin/os2web/DataLookup/DataLookupBase.php +++ b/src/Plugin/os2web/DataLookup/DataLookupBase.php @@ -2,6 +2,7 @@ namespace Drupal\os2web_datalookup\Plugin\os2web\DataLookup; +use Drupal\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\PluginBase; use Drupal\os2web_audit\Service\Logger; @@ -46,6 +47,18 @@ public function __construct( $this->setConfiguration($configuration); } + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('os2web_audit.logger'), + ); + } + /** * {@inheritdoc} */ From afa495f4ad1ab1308f89fae7a8a4e1c26aa162ce Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Tue, 29 Oct 2024 10:09:22 +0100 Subject: [PATCH 2/2] ITKDev: Use ContainerFactoryPluginInterface --- src/Plugin/os2web/DataLookup/DataLookupBase.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Plugin/os2web/DataLookup/DataLookupBase.php b/src/Plugin/os2web/DataLookup/DataLookupBase.php index bd40653..4c8dc25 100644 --- a/src/Plugin/os2web/DataLookup/DataLookupBase.php +++ b/src/Plugin/os2web/DataLookup/DataLookupBase.php @@ -2,10 +2,11 @@ namespace Drupal\os2web_datalookup\Plugin\os2web\DataLookup; -use Drupal\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\PluginBase; use Drupal\os2web_audit\Service\Logger; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides a base class for image effects. @@ -17,7 +18,7 @@ * @see \Drupal\image\ImageEffectManager * @see plugin_api */ -abstract class DataLookupBase extends PluginBase implements DataLookupInterface { +abstract class DataLookupBase extends PluginBase implements DataLookupInterface, ContainerFactoryPluginInterface { /** * Plugin readiness flag.