public function TypedData::getRoot

Implements \Drupal\Core\TypedData\TypedDataInterface::getRoot().

Overrides TypedDataInterface::getRoot

File

drupal/core/lib/Drupal/Core/TypedData/TypedData.php, line 132
Contains \Drupal\Core\TypedData\TypedData.

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;
}