You are here

function String::title in Views (for Drupal 7) 8.3

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

2 methods override String::title()
Type::title in lib/Views/node/Plugin/views/argument/Type.php
Override the behavior of title(). Get the user friendly version of the node type.
VocabularyMachineName::title in lib/Views/taxonomy/Plugin/views/argument/VocabularyMachineName.php
Override the behavior of title(). Get the name of the vocabulary..

File

lib/Drupal/views/Plugin/views/argument/String.php, line 253
Definition of Drupal\views\Plugin\views\argument\String.

Class

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

Namespace

Drupal\views\Plugin\views\argument

Code

function title() {
  $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
      ->breakPhraseString($this->argument, $this);
  }
  else {
    $this->value = array(
      $this->argument,
    );
    $this->operator = 'or';
  }
  if (empty($this->value)) {
    return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
  }
  if ($this->value === array(
    -1,
  )) {
    return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input');
  }
  return implode($this->operator == 'or' ? ' + ' : ', ', $this
    ->title_query());
}