You are here

protected function WebformScheduledEmailManager::getEntities in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_scheduled_email/src/WebformScheduledEmailManager.php \Drupal\webform_scheduled_email\WebformScheduledEmailManager::getEntities()

Inspects an entity and returns the associates webform, webform submission, and/or source entity.

Parameters

\Drupal\Core\Entity\EntityInterface|null $entity: A webform, webform submission, or source entity.

Return value

array An array containing webform, webform submission, and source entity.

3 calls to WebformScheduledEmailManager::getEntities()
WebformScheduledEmailManager::cronSchedule in modules/webform_scheduled_email/src/WebformScheduledEmailManager.php
Schedule emails.
WebformScheduledEmailManager::cronSend in modules/webform_scheduled_email/src/WebformScheduledEmailManager.php
Sending schedule emails.
WebformScheduledEmailManager::total in modules/webform_scheduled_email/src/WebformScheduledEmailManager.php
Get the total number of scheduled emails.

File

modules/webform_scheduled_email/src/WebformScheduledEmailManager.php, line 813

Class

WebformScheduledEmailManager
Defines the webform scheduled email manager.

Namespace

Drupal\webform_scheduled_email

Code

protected function getEntities(EntityInterface $entity = NULL) {
  $webform = NULL;
  $webform_submission = NULL;
  $source_entity = NULL;
  if ($entity instanceof WebformInterface) {
    $webform = $entity;
  }
  elseif ($entity instanceof WebformSubmissionInterface) {
    $webform_submission = $entity;
    $webform = $webform_submission
      ->getWebform();
  }
  elseif ($entity instanceof EntityInterface) {
    $source_entity = $entity;
    $webform = $this->entityReferenceManager
      ->getWebform($source_entity);
  }
  return [
    $webform,
    $webform_submission,
    $source_entity,
  ];
}