From 6f0fa1573ec5d0bee9a614a63a4baa23ba325814 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 14 Sep 2023 15:45:18 +0200 Subject: [PATCH] Made digital post module optional --- composer.json | 4 +++- modules/os2forms_forloeb/os2forms_forloeb.info.yml | 4 +++- modules/os2forms_forloeb/os2forms_forloeb.services.yml | 1 - modules/os2forms_forloeb/src/MaestroHelper.php | 5 ++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index cc8c44dd..7e3b2962 100644 --- a/composer.json +++ b/composer.json @@ -67,7 +67,6 @@ "drupal/webform_validation": "^2.0", "drupal/webform_views": "^5.0@alpha", "drupal/workflow_participants": "^2.4", - "os2forms/os2forms_digital_post": "^3.0", "os2web/os2web_datalookup": "^1.0", "os2web/os2web_nemlogin": "^1.0", "phpoffice/phpword": "^0.18.2", @@ -75,6 +74,9 @@ "webmozart/path-util": "^2.3", "zaporylie/composer-drupal-optimizations": "^1.2" }, + "suggest": { + "os2forms/os2forms_digital_post": "Send Maestro notifications via digital post (see https://github.com/itk-dev/os2forms_digital_post/blob/main/README.md)" + }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "drupal/coder": "^8.3", diff --git a/modules/os2forms_forloeb/os2forms_forloeb.info.yml b/modules/os2forms_forloeb/os2forms_forloeb.info.yml index cb8da319..fdf9f366 100644 --- a/modules/os2forms_forloeb/os2forms_forloeb.info.yml +++ b/modules/os2forms_forloeb/os2forms_forloeb.info.yml @@ -49,6 +49,8 @@ dependencies: - 'drupal:webform_submission_log' - 'drupal:webform_templates' - 'drupal:workflow_participants' - - 'os2forms_digital_post:os2forms_digital_post' + # os2forms_digital_post may be used for sending Meastro notifications via digital post + # - 'os2forms_digital_post:os2forms_digital_post' + 'interface translation project': os2forms_forloeb 'interface translation server pattern': modules/contrib/os2forms_forloeb/translations/os2forms_forloeb.da.po diff --git a/modules/os2forms_forloeb/os2forms_forloeb.services.yml b/modules/os2forms_forloeb/os2forms_forloeb.services.yml index 2d2b73ca..132f3f3b 100644 --- a/modules/os2forms_forloeb/os2forms_forloeb.services.yml +++ b/modules/os2forms_forloeb/os2forms_forloeb.services.yml @@ -19,4 +19,3 @@ services: - '@logger.channel.os2forms_forloeb_submission' - '@module_handler' - '@plugin.manager.entity_print.print_engine' - - '@Drupal\os2forms_digital_post\Helper\DigitalPostHelper' diff --git a/modules/os2forms_forloeb/src/MaestroHelper.php b/modules/os2forms_forloeb/src/MaestroHelper.php index 4554c1aa..e5f01fa5 100644 --- a/modules/os2forms_forloeb/src/MaestroHelper.php +++ b/modules/os2forms_forloeb/src/MaestroHelper.php @@ -88,7 +88,6 @@ public function __construct( readonly private LoggerChannelInterface $submissionLogger, readonly private ModuleHandlerInterface $moduleHandler, readonly private EntityPrintPluginManagerInterface $entityPrintPluginManager, - readonly private DigitalPostHelper $digitalPostHelper ) { $this->config = $configFactory->get(SettingsForm::SETTINGS); $this->webformSubmissionStorage = $entityTypeManager->getStorage('webform_submission'); @@ -342,8 +341,8 @@ private function sendNotificationDigitalPost( WebformSubmissionInterface $submission, string $notificationType ): void { - if (!$this->moduleHandler->moduleExists('os2forms_digital_post')) { - throw new RuntimeException('Cannot send digital post. Module os2forms_digital_post not installed.'); + if (NULL === $this->digitalPostHelper) { + throw new RuntimeException('Cannot send digital post. Module OS2Forms Digital Post (os2forms_digital_post) not installed.'); } try {