class LingotekDownloaderQueueWorker in Lingotek Translation 3.1.x
Same name and namespace in other branches
- 8.2 src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- 4.0.x src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- 3.0.x src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- 3.2.x src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- 3.3.x src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- 3.4.x src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- 3.5.x src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- 3.6.x src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- 3.7.x src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- 3.8.x src/Plugin/QueueWorker/LingotekDownloaderQueueWorker.php \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
Provides base functionality for the Lingotek Queue Workers.
Plugin annotation
@QueueWorker(
id = "lingotek_downloader_queue_worker",
title = @Translation("Lingotek Download Queue"),
cron = {"time" = 60}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
- class \Drupal\lingotek\Plugin\QueueWorker\LingotekDownloaderQueueWorker
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of LingotekDownloaderQueueWorker
File
- src/
Plugin/ QueueWorker/ LingotekDownloaderQueueWorker.php, line 18
Namespace
Drupal\lingotek\Plugin\QueueWorkerView source
class LingotekDownloaderQueueWorker extends QueueWorkerBase {
/**
* {@inheritdoc}
*/
public function processItem($data) {
$locale = $data['locale'];
$entity_type_id = $data['entity_type_id'];
$entity_id = $data['entity_id'];
$document_id = $data['document_id'];
$entity = \Drupal::entityTypeManager()
->getStorage($entity_type_id)
->load($entity_id);
/** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
$translation_service = \Drupal::service('lingotek.content_translation');
$translation_service
->setTargetStatus($entity, $locale, Lingotek::STATUS_READY);
$download = $translation_service
->downloadDocument($entity, $locale);
if ($download === FALSE || $download === NULL) {
$message = new FormattableMarkup('No download for target @locale happened in document @document on @entity @bundle @id.', [
'@locale' => $locale,
'@document' => $document_id,
'@entity' => $entity
->label(),
'@id' => $entity
->id(),
'@bundle' => $entity
->bundle(),
]);
\Drupal::logger('lingotek')
->error($message);
throw new \Exception($message);
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LingotekDownloaderQueueWorker:: |
public | function |
Works on a single queue item. Overrides QueueWorkerInterface:: |
|
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:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 98 |