public function EmailActivitySendAdvancedQueue::create in Open Social 10.2.x
Same name and namespace in other branches
- 10.3.x modules/custom/social_advanced_queue/src/Plugin/ActivitySend/EmailActivitySendAdvancedQueue.php \Drupal\social_advanced_queue\Plugin\ActivitySend\EmailActivitySendAdvancedQueue::create()
- 10.1.x modules/custom/social_advanced_queue/src/Plugin/ActivitySend/EmailActivitySendAdvancedQueue.php \Drupal\social_advanced_queue\Plugin\ActivitySend\EmailActivitySendAdvancedQueue::create()
Create a new item in queue on the action with some logic behind it.
Overrides EmailActivitySend::create
File
- modules/
custom/ social_advanced_queue/ src/ Plugin/ ActivitySend/ EmailActivitySendAdvancedQueue.php, line 17
Class
- EmailActivitySendAdvancedQueue
- Ensures the'EmailActivitySend' activity action uses Advanced Queue Jobs.
Namespace
Drupal\social_advanced_queue\Plugin\ActivitySendCode
public function create($entity) {
$data = [];
$data['entity_id'] = $entity
->id();
// Create a new Email Job and add to the "default" queue using
// advanced queue API instead of SocialSendEmails default Core Queue.
$job = Job::create('activity_send_email_worker', $data);
if ($job instanceof Job) {
$queue = Queue::load('default');
$queue
->enqueueJob($job);
}
}