You are here

class FeedQueueWorker in Feeds 8.3

Provides separate queue works for feed types.

Hierarchy

Expanded class hierarchy of FeedQueueWorker

See also

\Drupal\feeds\Plugin\QueueWorker\FeedRefresh

File

src/Plugin/Derivative/FeedQueueWorker.php, line 15

Namespace

Drupal\feeds\Plugin\Derivative
View source
class FeedQueueWorker extends DeriverBase implements ContainerDeriverInterface {

  /**
   * The entity storage.
   *
   * @var \Drupal\Core\Entity\EntityStorageInterface
   */
  protected $storage;

  /**
   * Constructs an FeedQueueWorker object.
   *
   * @param \Drupal\Core\Entity\EntityStorageInterface $storage
   *   The entity manager.
   */
  public function __construct(EntityStorageInterface $storage) {
    $this->storage = $storage;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    return new static($container
      ->get('entity_type.manager')
      ->getStorage('feeds_feed_type'));
  }

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $derivatives = [];
    foreach ($this->storage
      ->loadMultiple() as $feed_type) {
      $derivatives[$feed_type
        ->id()] = [
        'title' => t('Feed refresh: @feed_type_label', [
          '@feed_type_label' => $feed_type
            ->label(),
        ]),
      ] + $base_plugin_definition;
    }
    return $derivatives;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
FeedQueueWorker::$storage protected property The entity storage.
FeedQueueWorker::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
FeedQueueWorker::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
FeedQueueWorker::__construct public function Constructs an FeedQueueWorker object.