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. 10 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
Override the behavior of title(). Get the user friendly version of the node type.

File

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

Class

StringArgument
Basic argument handler to implement string arguments that may have length limits.

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.