You are here

class BrightcoveCustomFieldQueueWorker in Brightcove Video Connect 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/QueueWorker/BrightcoveCustomFieldQueueWorker.php \Drupal\brightcove\Plugin\QueueWorker\BrightcoveCustomFieldQueueWorker
  2. 8 src/Plugin/QueueWorker/BrightcoveCustomFieldQueueWorker.php \Drupal\brightcove\Plugin\QueueWorker\BrightcoveCustomFieldQueueWorker

Processes Entity Update Tasks for Custom Fields.

Plugin annotation


@QueueWorker(
  id = "brightcove_custom_field_queue_worker",
  title = @Translation("Brightcove custom field queue worker."),
  cron = { "time" = 30 }
)

Hierarchy

Expanded class hierarchy of BrightcoveCustomFieldQueueWorker

File

src/Plugin/QueueWorker/BrightcoveCustomFieldQueueWorker.php, line 20

Namespace

Drupal\brightcove\Plugin\QueueWorker
View source
class BrightcoveCustomFieldQueueWorker extends QueueWorkerBase implements ContainerFactoryPluginInterface {

  /**
   * The brightcove_custom_field storage.
   *
   * @var \Drupal\Core\Entity\EntityStorageInterface
   */
  protected $storage;

  /**
   * Constructs a new BrightcoveCustomFieldQueueWorker object.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param array $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Entity\EntityStorageInterface $storage
   *   The storage object.
   */
  public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityStorageInterface $storage) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->storage = $storage;
  }

  /**
   * {@inheritdoc}
   */
  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_custom_field'));
  }

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {

    /** @var \Brightcove\Item\CustomField $custom_field */
    $custom_field = $data['custom_field'];
    BrightcoveCustomField::createOrUpdate($custom_field, $this->storage, $data['api_client_id']);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BrightcoveCustomFieldQueueWorker::$storage protected property The brightcove_custom_field storage.
BrightcoveCustomFieldQueueWorker::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
BrightcoveCustomFieldQueueWorker::processItem public function Works on a single queue item. Overrides QueueWorkerInterface::processItem
BrightcoveCustomFieldQueueWorker::__construct public function Constructs a new BrightcoveCustomFieldQueueWorker object. Overrides PluginBase::__construct
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 2
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.