function ContentEntityStorageInterface::createWithSampleValues

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php \Drupal\Core\Entity\ContentEntityStorageInterface::createWithSampleValues()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php \Drupal\Core\Entity\ContentEntityStorageInterface::createWithSampleValues()
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php \Drupal\Core\Entity\ContentEntityStorageInterface::createWithSampleValues()

Creates an entity with sample field values.

Parameters

string|bool $bundle: (optional) The entity bundle.

array $values: (optional) Any default values to use during generation.

Return value

\Drupal\Core\Entity\FieldableEntityInterface A fieldable content entity.

Throws

\Drupal\Core\Entity\EntityStorageException Thrown if the bundle does not exist or was needed but not specified.

2 methods override ContentEntityStorageInterface::createWithSampleValues()
ContentEntityStorageBase::createWithSampleValues in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Creates an entity with sample field values.
KeyValueContentEntityStorage::createWithSampleValues in core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php
Creates an entity with sample field values.

File

core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php, line 24

Class

ContentEntityStorageInterface
A storage that supports content entity types.

Namespace

Drupal\Core\Entity

Code

public function createWithSampleValues($bundle = FALSE, array $values = []);

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