function entity_load

Loads an entity from the database.

Parameters

string $entity_type: The entity type to load, e.g. node or user.

int $id: The id of the entity to load.

bool $reset: Whether to reset the internal cache for the requested entity type.

Return value

Drupal\Core\Entity\EntityInterface The entity object, or FALSE if there is no entity with the given id.

See also

\Drupal\Core\Entity\EntityManager

entity_load_multiple()

Drupal\Core\Entity\EntityStorageControllerInterface

Drupal\Core\Entity\DatabaseStorageController

Drupal\Core\Entity\Query\QueryInterface

173 calls to entity_load()
AggregatorRenderingTest::testFeedPage in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorRenderingTest.php
Creates a feed and checks that feed's page.
aggregator_feed_load in drupal/core/modules/aggregator/aggregator.module
Loads an aggregator feed.
BlockInvalidRegionTest::testBlockInInvalidRegion in drupal/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php
Tests that blocks assigned to invalid regions work correctly.
BlockLanguageTest::testLanguageBlockVisibilityLanguageDelete in drupal/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php
Tests if the visibility settings are removed if the language is deleted.
BlockStorageUnitTest::renderTests in drupal/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php
Tests the rendering of blocks.

... See full list

File

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

Code

function entity_load($entity_type, $id, $reset = FALSE) {
  $entities = entity_load_multiple($entity_type, array(
    $id,
  ), $reset);
  return isset($entities[$id]) ? $entities[$id] : FALSE;
}