function ArgumentPluginBase::summaryNameField

Same name and namespace in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::summaryNameField()
  2. 10 core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::summaryNameField()
  3. 11.x core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::summaryNameField()

Adds the name field, which is the field displayed in summary queries.

This is often used when the argument is numeric.

3 calls to ArgumentPluginBase::summaryNameField()
ArgumentPluginBase::summaryQuery in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
Build the info for the summary query.
ManyToOne::summaryQuery in core/modules/views/src/Plugin/views/argument/ManyToOne.php
Build the info for the summary query.
StringArgument::summaryQuery in core/modules/views/src/Plugin/views/argument/StringArgument.php
Build the summary query based on a string.

File

core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php, line 877

Class

ArgumentPluginBase
Base class for argument (contextual filter) handler plugins.

Namespace

Drupal\views\Plugin\views\argument

Code

protected function summaryNameField() {
    // 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
                    ->addTable($this->name_table, $this->relationship, $join);
            }
        }
        else {
            $this->name_table_alias = $this->query
                ->ensureTable($this->name_table, $this->relationship);
        }
    }
    else {
        $this->name_table_alias = $this->tableAlias;
    }
    if (isset($this->name_field)) {
        $this->name_alias = $this->query
            ->addField($this->name_table_alias, $this->name_field);
    }
    else {
        $this->name_alias = $this->base_alias;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.