You are here

public function SocialSendEmailAdvancedQueue::createQueueItem in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.3.x modules/custom/social_advanced_queue/src/Plugin/Action/SocialSendEmailAdvancedQueue.php \Drupal\social_advanced_queue\Plugin\Action\SocialSendEmailAdvancedQueue::createQueueItem()
  2. 10.2.x modules/custom/social_advanced_queue/src/Plugin/Action/SocialSendEmailAdvancedQueue.php \Drupal\social_advanced_queue\Plugin\Action\SocialSendEmailAdvancedQueue::createQueueItem()

Create Queue Item.

Parameters

string $name: The name of the queue.

array $data: The queue data.

Overrides SocialSendEmail::createQueueItem

File

modules/custom/social_advanced_queue/src/Plugin/Action/SocialSendEmailAdvancedQueue.php, line 22

Class

SocialSendEmailAdvancedQueue
An example action covering most of the possible options.

Namespace

Drupal\social_advanced_queue\Plugin\Action

Code

public function createQueueItem($name, array $data) {

  // Create a new Email Job and add to the "default" queue using
  // advanced queue API instead of SocialSendEmails default Core Queue.
  $job = Job::create($name, $data);
  if ($job instanceof Job) {
    $queue = Queue::load('default');
    $queue
      ->enqueueJob($job);
  }
}