function ViewExecutable::getTitle

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getTitle()
  2. 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getTitle()
  3. 11.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getTitle()

Gets the view's current title.

This can change depending upon how it was built.

Return value

string|false The view title, FALSE if the display is not set.

File

core/modules/views/src/ViewExecutable.php, line 1841

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function getTitle() {
    if (empty($this->display_handler)) {
        if (!$this->setDisplay('default')) {
            return FALSE;
        }
    }
    // During building, we might find a title override. If so, use it.
    if (!empty($this->build_info['title'])) {
        $title = $this->build_info['title'];
    }
    else {
        $title = $this->display_handler
            ->getOption('title');
    }
    // Allow substitutions from the first row.
    if ($this->initStyle()) {
        $title = $this->style_plugin
            ->tokenizeValue($title, 0);
    }
    return $title;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.