WebformSubmissionEntityReferenceSelectFilter.php in Webform Views Integration 8.5
File
src/Plugin/views/filter/WebformSubmissionEntityReferenceSelectFilter.php
View source
<?php
namespace Drupal\webform_views\Plugin\views\filter;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Render\ElementInfoManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
class WebformSubmissionEntityReferenceSelectFilter extends WebformSubmissionSelectFilter {
protected $elementManager;
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'), $container
->get('element_info'));
}
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ElementInfoManager $element_info_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager);
$this->elementManager = $element_info_manager;
}
public function getValueOptions() {
if (!isset($this->valueOptions)) {
$element = $this
->getWebformElement();
$this->elementManager
->createInstance($element['#type'])
->setOptions($element);
$this->valueOptions = [
self::ALL => $this
->t('All'),
];
$this->valueOptions += $element['#options'];
}
return $this->valueOptions;
}
}