function MapDataDefinition::setPropertyDefinition

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

Sets the definition of a map property.

Parameters

string $name: The name of the property to define.

\Drupal\Core\TypedData\DataDefinitionInterface|null $definition: (optional) The property definition to set, or NULL to unset it.

Return value

$this

File

core/lib/Drupal/Core/TypedData/MapDataDefinition.php, line 57

Class

MapDataDefinition
A typed data definition class for defining maps.

Namespace

Drupal\Core\TypedData

Code

public function setPropertyDefinition($name, ?DataDefinitionInterface $definition = NULL) {
    if (isset($definition)) {
        $this->propertyDefinitions[$name] = $definition;
    }
    else {
        unset($this->propertyDefinitions[$name]);
    }
    return $this;
}

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