You are here

function ArgumentPluginBase::summary_name_field in Views (for Drupal 7) 8.3

Add the name field, which is the field displayed in summary queries. This is often used when the argument is numeric.

3 calls to ArgumentPluginBase::summary_name_field()
ArgumentPluginBase::summary_query in lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
Build the info for the summary query.
ManyToOne::summary_query in lib/Drupal/views/Plugin/views/argument/ManyToOne.php
Build the info for the summary query.
String::summary_query in lib/Drupal/views/Plugin/views/argument/String.php
Build the summary query based on a string

File

lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php, line 815
Definition of Drupal\views\Plugin\views\argument\ArgumentPluginBase.

Class

ArgumentPluginBase
Base class for arguments.

Namespace

Drupal\views\Plugin\views\argument

Code

function summary_name_field() {

  // Add the 'name' field. For example, if this is a uid argument, the
  // name field would be 'name' (i.e, the username).
  if (isset($this->name_table)) {

    // if the alias is different then we're probably added, not ensured,
    // so look up the join and add it instead.
    if ($this->tableAlias != $this->name_table) {
      $j = HandlerBase::getTableJoin($this->name_table, $this->table);
      if ($j) {
        $join = clone $j;
        $join->leftTable = $this->tableAlias;
        $this->name_table_alias = $this->query
          ->add_table($this->name_table, $this->relationship, $join);
      }
    }
    else {
      $this->name_table_alias = $this->query
        ->ensure_table($this->name_table, $this->relationship);
    }
  }
  else {
    $this->name_table_alias = $this->tableAlias;
  }
  if (isset($this->name_field)) {
    $this->name_alias = $this->query
      ->add_field($this->name_table_alias, $this->name_field);
  }
  else {
    $this->name_alias = $this->base_alias;
  }
}