public function ContentEntityStorageInterface::createWithSampleValues in Drupal 9
Same name and namespace in other branches
- 8 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\EntityCode
public function createWithSampleValues($bundle = FALSE, array $values = []);