You are here

public function WebformEntityListBuilder::__construct in Webform 8.5

Constructs a new WebformListBuilder object.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage class.

\Symfony\Component\HttpFoundation\RequestStack $request_stack: The request stack.

\Drupal\Core\Session\AccountInterface $current_user: The current user.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The configuration factory.

Overrides EntityListBuilder::__construct

File

src/WebformEntityListBuilder.php, line 105

Class

WebformEntityListBuilder
Defines a class to build a listing of webform entities.

Namespace

Drupal\webform

Code

public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, RequestStack $request_stack, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory = NULL) {
  parent::__construct($entity_type, $storage);
  $this->request = $request_stack
    ->getCurrentRequest();
  $this->currentUser = $current_user;
  $query = $this->request->query;
  $config = $config_factory
    ->get('webform.settings');
  $this->keys = $query
    ->has('search') ? $query
    ->get('search') : '';
  $this->category = $query
    ->has('category') ? $query
    ->get('category') : $config
    ->get('form.filter_category');
  $this->state = $query
    ->has('state') ? $query
    ->get('state') : $config
    ->get('form.filter_state');
  $this->bulkOperations = $config
    ->get('settings.webform_bulk_form') ?: FALSE;
  $this->submissionStorage = $entity_type_manager
    ->getStorage('webform_submission');
  $this->userStorage = $entity_type_manager
    ->getStorage('user');
  $this->roleStorage = $entity_type_manager
    ->getStorage('user_role');
}