You are here

public function MapDataDefinition::setPropertyDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 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;
}