You are here

class MediaPdfThumbnailGeneratorBase in Media PDF Thumbnail 8.4

Class MediaPdfThumbnailGeneratorBase

@package Drupal\media_pdf_thumbnail\Plugin\QueueWorker

Hierarchy

Expanded class hierarchy of MediaPdfThumbnailGeneratorBase

File

src/Plugin/QueueWorker/MediaPdfThumbnailGeneratorBase.php, line 16

Namespace

Drupal\media_pdf_thumbnail\Plugin\QueueWorker
View source
class MediaPdfThumbnailGeneratorBase extends QueueWorkerBase implements ContainerFactoryPluginInterface {

  /**
   * @var \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImageManager
   */
  protected $mediaPdfThumbnailImageManager;

  /**
   * MediaThumbnailGeneratorBase constructor.
   *
   * @param \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImageManager $mediaPdfThumbnailImageManager
   */
  public function __construct(MediaPdfThumbnailImageManager $mediaPdfThumbnailImageManager) {
    $this->mediaPdfThumbnailImageManager = $mediaPdfThumbnailImageManager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($container
      ->get('media_pdf_thumbnail.image.manager'));
  }

  /**
   * @param mixed $data
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   * @throws \Drupal\Core\Entity\EntityStorageException
   * @throws \Drupal\Core\TypedData\Exception\MissingDataException
   */
  public function processItem($data) {
    if ($data->media instanceof MediaInterface && !empty($data->field) && !empty($data->thumbnailType)) {
      $this->mediaPdfThumbnailImageManager
        ->createThumbnail($data->media, $data->field, $data->thumbnailType);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MediaPdfThumbnailGeneratorBase::$mediaPdfThumbnailImageManager protected property
MediaPdfThumbnailGeneratorBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
MediaPdfThumbnailGeneratorBase::processItem public function Overrides QueueWorkerInterface::processItem
MediaPdfThumbnailGeneratorBase::__construct public function MediaThumbnailGeneratorBase constructor. 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 3
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.