BrightcoveTextTrackQueueWorker.php in Brightcove Video Connect 8.2
File
src/Plugin/QueueWorker/BrightcoveTextTrackQueueWorker.php
View source
<?php
namespace Drupal\brightcove\Plugin\QueueWorker;
use Drupal\brightcove\Entity\BrightcoveTextTrack;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Queue\QueueWorkerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
class BrightcoveTextTrackQueueWorker extends QueueWorkerBase implements ContainerFactoryPluginInterface {
protected $storage;
public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityStorageInterface $storage) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->storage = $storage;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity_type.manager')
->getStorage('brightcove_text_track'));
}
public function processItem($data) {
$text_track = $data['text_track'];
BrightcoveTextTrack::createOrUpdate($text_track, $this->storage, $data['video_entity_id']);
}
}