EntityDataDefinition::setBundles

public EntityDataDefinition::setBundles(array $bundles = NULL)

Sets the array of possible entity bundles.

Parameters

array|null $bundles: The array of possible bundles, or NULL for any.

Return value

$this

Overrides EntityDataDefinitionInterface::setBundles

File

core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php, line 124

Class

EntityDataDefinition
A typed data definition class for describing entities.

Namespace

Drupal\Core\Entity\TypedData

Code

public function setBundles(array $bundles = NULL) {
  if (isset($bundles)) {
    $this->addConstraint('Bundle', $bundles);
  }
  else {
    // Remove the constraint.
    unset($this->definition['constraints']['Bundle']);
  }
  return $this;
}
doc_Drupal
2016-10-29 09:04:56
Comments
Leave a Comment

Please login to continue.