function TypedData::getRoot

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/TypedData.php \Drupal\Core\TypedData\TypedData::getRoot()
  2. 8.9.x core/lib/Drupal/Core/TypedData/TypedData.php \Drupal\Core\TypedData\TypedData::getRoot()
  3. 10 core/lib/Drupal/Core/TypedData/TypedData.php \Drupal\Core\TypedData\TypedData::getRoot()

Overrides TypedDataInterface::getRoot

File

core/lib/Drupal/Core/TypedData/TypedData.php, line 162

Class

TypedData
The abstract base class for typed data.

Namespace

Drupal\Core\TypedData

Code

public function getRoot() {
    if (isset($this->parent)) {
        return $this->parent
            ->getRoot();
    }
    // If no parent is set, this is the root of the data tree.
    return $this;
}

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