From 705d847ce0ec4e8e71aa6f25d2cf5bebafb645f2 Mon Sep 17 00:00:00 2001 From: Yohann Bianchi Date: Wed, 20 Sep 2023 22:25:57 +0200 Subject: [PATCH 1/3] style: remove unused imports --- src/TranslationImporter.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/TranslationImporter.php b/src/TranslationImporter.php index a53d071..de38457 100644 --- a/src/TranslationImporter.php +++ b/src/TranslationImporter.php @@ -1,8 +1,6 @@ Date: Wed, 20 Sep 2023 22:31:09 +0200 Subject: [PATCH 2/3] fix(drupal-10-compat): use the extension.path.resolver service instead of drupal_get_path --- kgaut_tools.module | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kgaut_tools.module b/kgaut_tools.module index 8ea82f1..f55807b 100755 --- a/kgaut_tools.module +++ b/kgaut_tools.module @@ -63,13 +63,14 @@ function kgaut_tools_entity_insert(EntityInterface $entity) { * Add custom variable to all templates. */ function kgaut_tools_preprocess(&$variables, $hook) { + $pathResolver = \Drupal::service('extension.path.resolver'); $isHttps = \Drupal::request()->isSecure() || \Drupal::service('settings')->get('force_https'); $variables['basepath'] = base_path(); $variables['baseurl_front'] = Url::fromRoute('', [], ['absolute' => TRUE, 'https' => $isHttps])->toString(); - $variables['pathtotheme'] = base_path() . drupal_get_path('theme', \Drupal::theme()->getActiveTheme()->getName()); - $variables['path_default_theme'] = base_path() . drupal_get_path('theme', \Drupal::config('system.theme')->get('default')); - $variables['baseurl_theme'] = $variables['baseurl_front'] . drupal_get_path('theme', \Drupal::theme()->getActiveTheme()->getName()); - $variables['baseurl_default_theme'] = $variables['baseurl_front'] . drupal_get_path('theme', \Drupal::config('system.theme')->get('default')); + $variables['pathtotheme'] = base_path() . $pathResolver->getPath('theme', \Drupal::theme()->getActiveTheme()->getName()); + $variables['path_default_theme'] = base_path() . $pathResolver->getPath('theme', \Drupal::config('system.theme')->get('default')); + $variables['baseurl_theme'] = $variables['baseurl_front'] . $pathResolver->getPath('theme', \Drupal::theme()->getActiveTheme()->getName()); + $variables['baseurl_default_theme'] = $variables['baseurl_front'] . $pathResolver->getPath('theme', \Drupal::config('system.theme')->get('default')); $variables['pathtotfiles'] = PublicStream::basePath(); $variables['baseurl_files'] = $variables['baseurl_front'] . PublicStream::basePath(); } @@ -93,8 +94,10 @@ function kgaut_tools_form_system_performance_settings_alter(&$form, \Drupal\Core * Add custom variables to DrupalSettings. */ function kgaut_tools_page_attachments(array &$attachments) { + $pathResolver = \Drupal::service('extension.path.resolver'); + $attachments['#attached']['drupalSettings']['basepath'] = base_path(); - $attachments['#attached']['drupalSettings']['pathtotheme'] = base_path() . drupal_get_path('theme', \Drupal::theme()->getActiveTheme()->getName()); + $attachments['#attached']['drupalSettings']['pathtotheme'] = base_path() . $pathResolver->getPath('theme', \Drupal::theme()->getActiveTheme()->getName()); $attachments['#attached']['drupalSettings']['pathtotfiles'] = PublicStream::basePath(); } From 318684437ff35c316ab4c650a1da96ca240a10d8 Mon Sep 17 00:00:00 2001 From: Yohann Bianchi Date: Wed, 20 Sep 2023 22:38:27 +0200 Subject: [PATCH 3/3] fix(drupal-10-compat): fix compatibility with symfony/event-dispatcher=^6.0.0 --- kgaut_tools.module | 2 +- src/Event/UserLoginEvent.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kgaut_tools.module b/kgaut_tools.module index f55807b..faa7400 100755 --- a/kgaut_tools.module +++ b/kgaut_tools.module @@ -169,5 +169,5 @@ function kgaut_tools_theme_suggestions_page(array $variables) { function kgaut_tools_user_login($account) { $event = new \Drupal\kgaut_tools\Event\UserLoginEvent($account); $event_dispatcher = \Drupal::service('event_dispatcher'); - $event_dispatcher->dispatch($event::EVENT_NAME, $event); + $event_dispatcher->dispatch($event, $event::EVENT_NAME); } diff --git a/src/Event/UserLoginEvent.php b/src/Event/UserLoginEvent.php index 583a577..9d64dd7 100644 --- a/src/Event/UserLoginEvent.php +++ b/src/Event/UserLoginEvent.php @@ -3,7 +3,7 @@ namespace Drupal\kgaut_tools\Event; use Drupal\user\UserInterface; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; /** * Event that is fired when a user logs in.