public function StringArgument::title in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/src/Plugin/views/argument/StringArgument.php \Drupal\views\Plugin\views\argument\StringArgument::title()
Get the title this argument will assign the view, given the argument.
This usually needs to be overridden to provide a proper 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\argumentCode
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());
}