You are here

protected function YamlFormSubmissionListBuilder::getEntityIds in YAML Form 8

Loads entity IDs using a pager sorted by the entity id.

Return value

array An array of entity IDs.

Overrides EntityListBuilder::getEntityIds

File

src/YamlFormSubmissionListBuilder.php, line 557

Class

YamlFormSubmissionListBuilder
Provides a list controller for yamlform submission entity.

Namespace

Drupal\yamlform

Code

protected function getEntityIds() {
  $query = $this
    ->getQuery($this->keys, $this->state);
  $query
    ->pager($this->limit);
  $header = $this
    ->buildHeader();
  $order = tablesort_get_order($header);
  $direction = tablesort_get_sort($header);

  // If query is order(ed) by 'element__*' we need to build a custom table
  // sort using hook_query_alter().
  // @see: yamlform_query_alter()
  if ($order && strpos($order['sql'], 'element__') === 0) {
    $name = $order['sql'];
    $column = $this->columns[$name];
    $query
      ->addMetaData('yamlform_submission_element_name', $column['key']);
    $query
      ->addMetaData('yamlform_submission_element_property_name', $column['property_name']);
    $query
      ->addMetaData('yamlform_submission_element_direction', $direction);
  }
  else {
    $query
      ->tableSort($header);
  }
  return $query
    ->execute();
}