class BynderTestImageRemove in Bynder 8
Same name and namespace in other branches
- 8.3 src/Plugin/QueueWorker/BynderTestImageRemove.php \Drupal\bynder\Plugin\QueueWorker\BynderTestImageRemove
- 8.2 src/Plugin/QueueWorker/BynderTestImageRemove.php \Drupal\bynder\Plugin\QueueWorker\BynderTestImageRemove
- 4.0.x src/Plugin/QueueWorker/BynderTestImageRemove.php \Drupal\bynder\Plugin\QueueWorker\BynderTestImageRemove
Removes uploaded test images.
Plugin annotation
@QueueWorker(
id = "bynder_test_image_remove",
title = @Translation("Bynder test image remove"),
cron = {"time" = 60}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
- class \Drupal\bynder\Plugin\QueueWorker\BynderTestImageRemove implements ContainerFactoryPluginInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of BynderTestImageRemove
File
- src/
Plugin/ QueueWorker/ BynderTestImageRemove.php, line 21
Namespace
Drupal\bynder\Plugin\QueueWorkerView source
class BynderTestImageRemove extends QueueWorkerBase implements ContainerFactoryPluginInterface {
/**
* The minimum delay in seconds for items to wait until processed.
*
* @var int
*/
const DELAY = 600;
/**
* Bynder api service.
*
* @var \Drupal\bynder\BynderApiInterface
* Bynder api service.
*/
protected $bynder;
/**
* The time service.
*
* @var \Drupal\Component\Datetime\TimeInterface
*/
protected $time;
/**
* BynderTestImageRemove constructor.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\bynder\BynderApiInterface $bynder
* The Bynder API service.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, BynderApiInterface $bynder, TimeInterface $time) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->bynder = $bynder;
$this->time = $time;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('bynder_api'), $container
->get('datetime.time'));
}
/**
* {@inheritdoc}
*/
public function processItem($data) {
if ($data['created'] + static::DELAY <= $this->time
->getRequestTime()) {
$this->bynder
->deleteMedia($data['mediaid']);
}
else {
throw new RequeueException('Minimum wait time has not passed for this item.');
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BynderTestImageRemove:: |
protected | property | Bynder api service. | |
BynderTestImageRemove:: |
protected | property | The time service. | |
BynderTestImageRemove:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
BynderTestImageRemove:: |
constant | The minimum delay in seconds for items to wait until processed. | ||
BynderTestImageRemove:: |
public | function |
Works on a single queue item. Overrides QueueWorkerInterface:: |
|
BynderTestImageRemove:: |
public | function |
BynderTestImageRemove constructor. 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. |