Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DanLaufer/ae109c950cce1fc58f8208ef88e93f79 to your computer and use it in GitHub Desktop.
Save DanLaufer/ae109c950cce1fc58f8208ef88e93f79 to your computer and use it in GitHub Desktop.
Drupal 8 - Load entities with EntityTypeManager
// single
$service = \Drupal::service('entity_type.manager')->getStorage('node');
$node = $service->load(22);
// multiple
$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->loadMultiple(array(22, 14, 8));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment