Iid.php in Zircon Profile 8
File
core/modules/aggregator/src/Plugin/views/argument/Iid.php
View source
<?php
namespace Drupal\aggregator\Plugin\views\argument;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\views\Plugin\views\argument\NumericArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
class Iid extends NumericArgument {
protected $entityManager;
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityManager = $entity_manager;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity.manager'));
}
public function titleQuery() {
$titles = array();
$items = $this->entityManager
->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. |