3 namespace Drupal\aggregator\Plugin\views\argument;
5 use Drupal\Core\Entity\EntityManagerInterface;
6 use Drupal\views\Plugin\views\argument\NumericArgument;
7 use Symfony\Component\DependencyInjection\ContainerInterface;
10 * Argument handler to accept an aggregator feed id.
12 * @ingroup views_argument_handlers
14 * @ViewsArgument("aggregator_fid")
16 class Fid extends NumericArgument {
19 * The entity manager service.
21 * @var \Drupal\Core\Entity\EntityManagerInterface
23 protected $entityManager;
26 * Constructs a Drupal\Component\Plugin\PluginBase object.
28 * @param array $configuration
29 * A configuration array containing information about the plugin instance.
30 * @param string $plugin_id
31 * The plugin_id for the plugin instance.
32 * @param mixed $plugin_definition
33 * The plugin implementation definition.
34 * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
37 public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {
38 parent::__construct($configuration, $plugin_id, $plugin_definition);
39 $this->entityManager = $entity_manager;
45 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
46 return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity.manager'));
52 public function titleQuery() {
55 $feeds = $this->entityManager->getStorage('aggregator_feed')->loadMultiple($this->value);
56 foreach ($feeds as $feed) {
57 $titles[] = $feed->label();