@@ -251,13 +251,14 @@ private function sendNotification(
251251 'subject ' => $ subject ,
252252 'taskUrl ' => $ taskUrl ,
253253 'actionLabel ' => $ actionLabel ,
254+ 'senderLabel ' => $ senderLabel ,
254255 ] = $ this ->renderNotification ($ submission , $ handler ->getHandlerId (), $ notificationType , $ templateTask , $ maestroQueueID );
255256
256257 if ('email ' === $ contentType ) {
257258 $ this ->sendNotificationEmail ($ recipient , $ subject , $ content , $ submission , $ notificationType );
258259 }
259260 else {
260- $ this ->sendNotificationDigitalPost ($ recipient , $ subject , $ content , $ taskUrl , $ actionLabel , $ submission , $ notificationType );
261+ $ this ->sendNotificationDigitalPost ($ recipient , $ subject , $ content , $ taskUrl , $ actionLabel , $ submission , $ notificationType, $ senderLabel );
261262 }
262263 }
263264 }
@@ -369,7 +370,9 @@ private function sendNotificationEmail(
369370 * @param \Drupal\webform\WebformSubmissionInterface $submission
370371 * The webform submission.
371372 * @param string $notificationType
372- * The notification type (one of the NOTIFICATION_* constannts).
373+ * The notification type (one of the NOTIFICATION_* constants).
374+ * @param string $senderLabel
375+ * The sender label.
373376 */
374377 private function sendNotificationDigitalPost (
375378 string $ recipient ,
@@ -379,6 +382,7 @@ private function sendNotificationDigitalPost(
379382 string $ actionLabel ,
380383 WebformSubmissionInterface $ submission ,
381384 string $ notificationType ,
385+ string $ senderLabel ,
382386 ): void {
383387 try {
384388 $ document = new Document (
@@ -387,7 +391,6 @@ private function sendNotificationDigitalPost(
387391 $ subject . '.pdf '
388392 );
389393
390- $ senderLabel = $ subject ;
391394 $ messageLabel = $ subject ;
392395
393396 $ recipientLookupResult = $ this ->digitalPostHelper ->lookupRecipient ($ recipient );
@@ -437,13 +440,13 @@ private function sendNotificationDigitalPost(
437440 * @param string $handlerId
438441 * The handler ID.
439442 * @param string $notificationType
440- * The notification type (one of the NOTIFICATION_* constannts ).
443+ * The notification type (one of the NOTIFICATION_* constants ).
441444 * @param array $templateTask
442445 * The Maestro template task.
443446 * @param int $maestroQueueID
444447 * The Maestro queue ID.
445448 * @param string|null $contentType
446- * Optional content type. If not set the content type will be compoted based
449+ * Optional content type. If not set the content type will be computed based
447450 * on the recipient.
448451 *
449452 * @return array
@@ -454,13 +457,20 @@ private function sendNotificationDigitalPost(
454457 * - subject
455458 * - taskUrl (for digital post)
456459 * - actionLabel (for digital post)
460+ * - senderLabel (for digital post)
457461 *
458462 * @see self::renderHtml()
459463 */
460464 public function renderNotification (WebformSubmissionInterface $ submission , string $ handlerId , string $ notificationType , array $ templateTask , int $ maestroQueueID , ?string $ contentType = NULL ): array {
461465 $ handler = $ submission ->getWebform ()->getHandler ($ handlerId );
462466 $ settings = $ handler ->getSettings ();
463467
468+ $ senderLabel = $ settings [MaestroNotificationHandler::NOTIFICATION ][MaestroNotificationHandler::SENDER_LABEL ] ?? NULL ;
469+
470+ if (NULL === $ senderLabel ) {
471+ throw new RuntimeException (sprintf ('Cannot get setting for Maestro notification: %s ' , MaestroNotificationHandler::SENDER_LABEL ));
472+ }
473+
464474 $ data = $ submission ->getData ();
465475 $ recipientElement = $ settings [MaestroNotificationHandler::NOTIFICATION ][MaestroNotificationHandler::RECIPIENT_ELEMENT ] ?? NULL ;
466476 // Handle os2forms_person_lookup element.
@@ -559,6 +569,7 @@ public function renderNotification(WebformSubmissionInterface $submission, strin
559569 'subject ' => $ subject ,
560570 'taskUrl ' => $ taskUrl ,
561571 'actionLabel ' => $ actionLabel ,
572+ 'senderLabel ' => $ senderLabel ,
562573 ];
563574 }
564575
0 commit comments