You are here

public function StringContainsArgument::title in Media Directories 8

Same name and namespace in other branches
  1. 2.x modules/media_directories_ui/src/Plugin/views/argument/StringContainsArgument.php \Drupal\media_directories_ui\Plugin\views\argument\StringContainsArgument::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

modules/media_directories_ui/src/Plugin/views/argument/StringContainsArgument.php, line 34

Class

StringContainsArgument
Media directory ui string contains argument plugin.

Namespace

Drupal\media_directories_ui\Plugin\views\argument

Code

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 === [
    '',
  ]) {
    return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : $this
      ->t('Invalid input');
  }
  return implode($this->operator == 'or' ? ' + ' : ', ', $this
    ->titleQuery());
}