public function MediaDirectoryArgument::title in Media Directories 8
Same name and namespace in other branches
- 3.x src/Plugin/views/argument/MediaDirectoryArgument.php \Drupal\media_directories\Plugin\views\argument\MediaDirectoryArgument::title()
- 2.x src/Plugin/views/argument/MediaDirectoryArgument.php \Drupal\media_directories\Plugin\views\argument\MediaDirectoryArgument::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
File
- src/
Plugin/ views/ argument/ MediaDirectoryArgument.php, line 69
Class
- MediaDirectoryArgument
- Media directory argument plugin.
Namespace
Drupal\media_directories\Plugin\views\argumentCode
public function title() {
if (!$this->argument) {
return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this
->t('Uncategorized');
}
if (!empty($this->options['break_phrase'])) {
$break = static::breakString($this->argument, FALSE);
$this->value = $break->value;
$this->operator = $break->operator;
}
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 === [
MEDIA_DIRECTORY_ROOT,
]) {
return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : $this
->t('Invalid input');
}
return implode($this->operator == 'or' ? ' + ' : ', ', $this
->titleQuery());
}