You are here

protected function YamlFormSubmissionListBuilder::addQueryConditions in YAML Form 8

Add form, account, and source entity conditions to a query.

Parameters

\Drupal\Core\Database\Query\AlterableInterface $query: The query to execute.

1 call to YamlFormSubmissionListBuilder::addQueryConditions()
YamlFormSubmissionListBuilder::getQuery in src/YamlFormSubmissionListBuilder.php
Get the base entity query filtered by form and search.

File

src/YamlFormSubmissionListBuilder.php, line 642

Class

YamlFormSubmissionListBuilder
Provides a list controller for yamlform submission entity.

Namespace

Drupal\yamlform

Code

protected function addQueryConditions(AlterableInterface $query) {

  // Limit submission to the current form.
  if ($this->yamlform) {
    $query
      ->condition('yamlform_id', $this->yamlform
      ->id());
  }

  // Limit submission to the current user.
  if ($this->account) {
    $query
      ->condition('uid', $this->account
      ->id());
  }

  // Filter entity type and id. (Currently only applies to yamlform_node.module)
  if ($this->sourceEntity) {
    $query
      ->condition('entity_type', $this->sourceEntity
      ->getEntityTypeId());
    $query
      ->condition('entity_id', $this->sourceEntity
      ->id());
  }
}