1 views_handler_argument_many_to_one.inc views_handler_argument_many_to_one::summary_query()

Build the info for the summary query.

This must:

  • add_groupby: group on this field in order to create summaries.
  • add_field: add a 'num_nodes' field for the count. Usually it will be a count on $view->base_field
  • set_count_field: Reset the count field so we get the right paging.

Return value

The alias used to get the number of records (count) for this entry.:

Overrides views_handler_argument::summary_query

File

core/modules/views/handlers/views_handler_argument_many_to_one.inc, line 147
Definition of views_handler_argument_many_to_one.

Class

views_handler_argument_many_to_one
An argument handler for use in fields that have a many to one relationship with the table(s) to the left. This adds a bunch of options that are reasonably common with this type of relationship. Definition terms:

Code

function summary_query() {
  $field = $this->table . '.' . $this->field;
  $join = $this->get_join();

  if (!empty($this->options['require_value'])) {
    $join->type = 'INNER';
  }

  if (empty($this->options['add_table']) || empty($this->view->many_to_one_tables[$field])) {
    $this->table_alias = $this->query->ensure_table($this->table, $this->relationship, $join);
  }
  else {
    $this->table_alias = $this->helper->summary_join();
  }

  // Add the field.
  $this->base_alias = $this->query->add_field($this->table_alias, $this->real_field);

  $this->summary_name_field();

  return $this->summary_basics();
}