You are here

public function ViewsJsonQuery::addField in Views Json Source 8

Same name and namespace in other branches
  1. 1.x src/Plugin/views/query/ViewsJsonQuery.php \Drupal\views_json_source\Plugin\views\query\ViewsJsonQuery::addField()

Add a field.

File

src/Plugin/views/query/ViewsJsonQuery.php, line 518

Class

ViewsJsonQuery
Base query handler for views_json_source.

Namespace

Drupal\views_json_source\Plugin\views\query

Code

public function addField($table, $field, $alias = '', $params = []) {
  $alias = $field;

  // Add field info array.
  if (empty($this->fields[$field])) {
    $this->fields[$field] = [
      'field' => $field,
      'table' => $table,
      'alias' => $alias,
    ] + $params;
  }
  return $field;
}