function TypedData::setContext

Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/TypedData/TypedData.php \Drupal\Core\TypedData\TypedData::setContext()
  2. 10 core/lib/Drupal/Core/TypedData/TypedData.php \Drupal\Core\TypedData\TypedData::setContext()
  3. 11.x core/lib/Drupal/Core/TypedData/TypedData.php \Drupal\Core\TypedData\TypedData::setContext()

Sets the context of a property or item via a context aware parent.

This method is supposed to be called by the factory only.

Parameters

string|null $name: (optional) The name of the property or the delta of the list item, or NULL if it is the root of a typed data tree. Defaults to NULL.

\Drupal\Core\TypedData\TraversableTypedDataInterface|null $parent: (optional) The parent object of the data property, or NULL if it is the root of a typed data tree. Defaults to NULL.

Overrides TypedDataInterface::setContext

File

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

Class

TypedData
The abstract base class for typed data.

Namespace

Drupal\Core\TypedData

Code

public function setContext($name = NULL, TraversableTypedDataInterface $parent = NULL) {
    $this->parent = $parent;
    $this->name = $name;
}

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