cforge-2.0.x-dev/modules/cforge_broadcast/src/Plugin/QueueWorker/AutoNews.php
modules/cforge_broadcast/src/Plugin/QueueWorker/AutoNews.php
<?php
namespace Drupal\cforge_broadcast\Plugin\QueueWorker;
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\user\Entity\User;
/**
* Updates a feed's items.
*
* @QueueWorker(
* id = "cforge_autonews",
* title = @Translation("Cforge auto-news"),
* cron = {"time" = 60}
* )
*/
class AutoNews extends QueueWorkerBase {
/**
* {@inheritdoc}
*/
public function processItem($data) {
$account = User::load($data['uid']);
$params = [
'user' => $account,
'since' => $data['since'],
];
\Drupal::service('plugin.manager.mail')
->mail('cforge_broadcast', 'autonews', $account->mail, $account->getPreferredLangcode(), $params);
}
}
