function Node::getTitle

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

Gets the node title.

Return value

string|null Title of the node, or NULL if the node doesn't yet have a title (for example, if a new node is being previewed).

Overrides NodeInterface::getTitle

File

core/modules/node/src/Entity/Node.php, line 203

Class

Node
Defines the node entity class.

Namespace

Drupal\node\Entity

Code

public function getTitle() {
    return $this->get('title')->value;
}

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