You are here

public function WebformScheduledEmailController::cron in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_scheduled_email/src/Controller/WebformScheduledEmailController.php \Drupal\webform_scheduled_email\Controller\WebformScheduledEmailController::cron()

Runs cron task for webform scheduled email handler.

Parameters

\Drupal\webform\WebformInterface $webform: The webform containing a scheduled email handler.

string|null $handler_id: A webform handler id.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirection to the webform handlers page.

1 string reference to 'WebformScheduledEmailController::cron'
webform_scheduled_email.routing.yml in modules/webform_scheduled_email/webform_scheduled_email.routing.yml
modules/webform_scheduled_email/webform_scheduled_email.routing.yml

File

modules/webform_scheduled_email/src/Controller/WebformScheduledEmailController.php, line 54

Class

WebformScheduledEmailController
Provides route responses for webform scheduled email.

Namespace

Drupal\webform_scheduled_email\Controller

Code

public function cron(WebformInterface $webform, $handler_id) {
  $stats = $this->manager
    ->cron($webform, $handler_id);
  $this
    ->messenger()
    ->addStatus($this
    ->t($stats['_message'], $stats['_context']));
  return new RedirectResponse($webform
    ->toUrl('handlers')
    ->toString());
}