TypedData::getPropertyPath

public TypedData::getPropertyPath()

Returns the property path of the data.

The trail of property names relative to the root of the typed data tree, separated by dots; e.g. 'field_text.0.format'.

Return value

string The property path relative to the root of the typed tree, or an empty string if this is the root.

Overrides TypedDataInterface::getPropertyPath

File

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

Class

TypedData
The abstract base class for typed data.

Namespace

Drupal\Core\TypedData

Code

public function getPropertyPath() {
  if (isset($this->parent)) {
    // The property path of this data object is the parent's path appended
    // by this object's name.
    $prefix = $this->parent->getPropertyPath();
    return (strlen($prefix) ? $prefix . '.' : '') . $this->name;
  }
  // If no parent is set, this is the root of the data tree. Thus the property
  // path equals the name of this data object.
  elseif (isset($this->name)) {
    return $this->name;
  }
  return '';
}
doc_Drupal
2016-10-29 09:50:00
Comments
Leave a Comment

Please login to continue.