JobType.php in Advanced Queue 8
File
src/Plugin/views/field/JobType.php
View source
<?php
namespace Drupal\advancedqueue\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
class JobType extends FieldPluginBase {
public function render(ResultRow $values) {
$type = $this
->getValue($values);
$job_type_options = self::getOptions();
if (isset($job_type_options[$type])) {
return $job_type_options[$type];
}
return parent::render($values);
}
public static function getOptions() {
$job_type_manager = \Drupal::service('plugin.manager.advancedqueue_job_type');
return array_map(function ($definition) {
return $definition['label'];
}, $job_type_manager
->getDefinitions());
}
}
Classes
Name |
Description |
JobType |
Field handler to render a human readable job type label. |