Skip to content

Commit

Permalink
Cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Sep 29, 2023
1 parent a0904ab commit 0a576fc
Showing 1 changed file with 38 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Drupal\os2forms_forloeb\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Drupal\os2forms_digital_post\Model\Document;
use Drupal\os2forms_forloeb\MaestroHelper;
Expand Down Expand Up @@ -39,9 +38,23 @@ public static function create(ContainerInterface $container) {
}

/**
* Preview action.
* Preview notification action.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The request.
* @param \Drupal\webform\WebformInterface $webform
* The webform.
* @param string $handler
* The handler ID.
* @param string $notification_type
* The notification type.
* @param string $content_type
* The content type.
*
* @return array
* A render array.
*/
public function preview(Request $request, WebformInterface $webform, string $handler, string $notification_type, string $content_type, RouteMatchInterface $routeMatch) {
public function preview(Request $request, WebformInterface $webform, string $handler, string $notification_type, string $content_type): array {
$handler = $webform->getHandler($handler);
$submissionIds = array_keys($this->webformSubmissionStorage->getQuery()
->condition('webform_id', $webform->id())
Expand Down Expand Up @@ -103,8 +116,20 @@ public function preview(Request $request, WebformInterface $webform, string $han

/**
* Render notification preview.
*
* @param string $handler
* The handler ID.
* @param string $notification_type
* The notification type.
* @param string $content_type
* The content type.
* @param \Drupal\webform\WebformSubmissionInterface $submission
* The webform submission.
*
* @return \Symfony\Component\HttpFoundation\Response
* The response.
*/
public function previewRender(Request $request, WebformInterface $webform, string $handler, string $notification_type, string $content_type, WebformSubmissionInterface $submission) {
public function previewRender(string $handler, string $notification_type, string $content_type, WebformSubmissionInterface $submission) {
$templateTask = [];
$maestroQueueID = 0;
[
Expand All @@ -122,6 +147,15 @@ public function previewRender(Request $request, WebformInterface $webform, strin

/**
* Message action.
*
* Used only to show a message when a Maestro task link from a notification
* preview is clicked.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The request.
*
* @return \Symfony\Component\HttpFoundation\Response
* The response.
*/
public function message(Request $request): Response {
$content[] = '<h1>' . $request->get('message') . '</h1>';
Expand Down

0 comments on commit 0a576fc

Please sign in to comment.