public TypedData::getRoot()
Returns the root of the typed data tree.
Returns the root data for a tree of typed data objects; e.g. for an entity field item the root of the tree is its parent entity object.
Return value
\Drupal\Core\TypedData\TraversableTypedDataInterface The root data structure, either complex data or a list.
Overrides TypedDataInterface::getRoot
File
- core/lib/Drupal/Core/TypedData/TypedData.php, line 165
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; }
Please login to continue.