class CronHotspotsWorker in Image Hotspots 8
Deletes hotspots in queue on CRON run.
Plugin annotation
@QueueWorker(
id = "cron_image_hotspots_deletion",
title = @Translation("Cron image hotspots deletion"),
cron = {"time" = 10}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
- class \Drupal\image_hotspots\Plugin\QueueWorker\CronHotspotsWorker implements ContainerFactoryPluginInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of CronHotspotsWorker
File
- src/
Plugin/ QueueWorker/ CronHotspotsWorker.php, line 19
Namespace
Drupal\image_hotspots\Plugin\QueueWorkerView source
class CronHotspotsWorker extends QueueWorkerBase implements ContainerFactoryPluginInterface {
/**
* The image hotspots storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $hotspotsStorage;
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $hotspots_storage) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->hotspotsStorage = $hotspots_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('image_hotspot'));
}
/**
* {@inheritdoc}
*/
public function processItem($data) {
$hotspot = $this->hotspotsStorage
->load($data['hid']);
if (!is_null($hotspot)) {
$hotspot
->delete();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CronHotspotsWorker:: |
protected | property | The image hotspots storage. | |
CronHotspotsWorker:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
CronHotspotsWorker:: |
public | function |
Works on a single queue item. Overrides QueueWorkerInterface:: |
|
CronHotspotsWorker:: |
public | function |
Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. |