function entity_create

Constructs a new entity object, without permanently saving it.

Parameters

$entity_type: The type of the entity.

$values: An array of values to set, keyed by property name. If the entity type has bundles the bundle key has to be specified.

Return value

Drupal\Core\Entity\EntityInterface A new entity object.

264 calls to entity_create()
AggregatorTestBase::getFeedEditObject in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php
Returns a randomly generated feed edit object.
BlockTemplateSuggestionsUnitTest::testBlockThemeHookSuggestions in drupal/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php
Test if template_preprocess_block() handles the suggestions right.
BlockTestBase::setUp in drupal/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php
Sets up a Drupal site for running functional and integration tests.
block_admin_add in drupal/core/modules/block/block.admin.inc
Page callback: Build the block instance add form.
BreadcrumbTest::testBreadCrumbs in drupal/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
Tests breadcrumbs on node and administrative paths.

... See full list

File

drupal/core/includes/entity.inc, line 347
Entity API for handling entities like nodes or users.

Code

function entity_create($entity_type, array $values) {
  return Drupal::entityManager()
    ->getStorageController($entity_type)
    ->create($values);
}