function StringArgument::title

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/argument/StringArgument.php \Drupal\views\Plugin\views\argument\StringArgument::title()
  2. 8.9.x core/modules/views/src/Plugin/views/argument/StringArgument.php \Drupal\views\Plugin\views\argument\StringArgument::title()
  3. 11.x core/modules/views/src/Plugin/views/argument/StringArgument.php \Drupal\views\Plugin\views\argument\StringArgument::title()

Overrides ArgumentPluginBase::title

1 method overrides StringArgument::title()
Type::title in core/modules/node/src/Plugin/views/argument/Type.php
Get the title this argument will assign the view, given the argument.

File

core/modules/views/src/Plugin/views/argument/StringArgument.php, line 289

Class

StringArgument
Argument handler for string.

Namespace

Drupal\views\Plugin\views\argument

Code

public function title() {
    // Support case-insensitive title comparisons for PostgreSQL by converting
    // the title to lowercase.
    if ($this->options['case'] != 'none' && Database::getConnection()->databaseType() == 'pgsql') {
        $this->options['case'] = 'lower';
    }
    $this->argument = $this->caseTransform($this->argument, $this->options['case']);
    if (!empty($this->options['transform_dash'])) {
        $this->argument = strtr($this->argument, '-', ' ');
    }
    if (!empty($this->options['break_phrase'])) {
        $this->unpackArgumentValue();
    }
    else {
        $this->value = [
            $this->argument,
        ];
        $this->operator = 'or';
    }
    if (empty($this->value)) {
        return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized');
    }
    if ($this->value === [
        -1,
    ]) {
        return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : $this->t('Invalid input');
    }
    return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery());
}

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