You are here

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

Override the behavior of title(). Get the name of the vocabulary..

Overrides String::title

File

lib/Views/taxonomy/Plugin/views/argument/VocabularyMachineName.php, line 28
Definition of Views\taxonomy\Plugin\views\argument\VocabularyMachineName.

Class

VocabularyMachineName
Argument handler to accept a vocabulary machine name.

Namespace

Views\taxonomy\Plugin\views\argument

Code

function title() {
  $query = db_select('taxonomy_vocabulary', 'v');
  $query
    ->addField('v', 'name');
  $query
    ->condition('v.machine_name', $this->argument);
  $title = $query
    ->execute()
    ->fetchField();
  if (empty($title)) {
    return t('No vocabulary');
  }
  return check_plain($title);
}