Iid.php in Drupal 8
File
core/modules/aggregator/src/Plugin/views/argument/Iid.php
View source
<?php
namespace Drupal\aggregator\Plugin\views\argument;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\views\Plugin\views\argument\NumericArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
class Iid extends NumericArgument {
use DeprecatedServicePropertyTrait;
protected $deprecatedProperties = [
'entityManager' => 'entity.manager',
];
protected $entityTypeManager;
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entity_type_manager;
}
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'));
}
public function titleQuery() {
$titles = [];
$items = $this->entityTypeManager
->getStorage('aggregator_item')
->loadMultiple($this->value);
foreach ($items as $feed) {
$titles[] = $feed
->label();
}
return $titles;
}
}
Classes
Name |
Description |
Iid |
Argument handler to accept an aggregator item id. |