diff --git a/src/TwigExtension.php b/src/TwigExtension.php index 9ed9abc..36d6675 100644 --- a/src/TwigExtension.php +++ b/src/TwigExtension.php @@ -623,13 +623,12 @@ class TwigExtension extends AbstractExtension { * The processed form for the given entity type and form mode. */ public function drupalEntityForm($entity_type, $id = NULL, $form_mode = 'default', array $values = [], $check_access = TRUE) { - $entity_storage = \Drupal::entityTypeManager()->getStorage($entity_type); if ($id) { - $entity = $entity_storage->load($id); + $entity = \Drupal::service('entity.repository')->getActive($entity_type, $id); $operation = 'update'; } else { - $entity = $entity_storage->create($values); + $entity = \Drupal::entityTypeManager()->getStorage($entity_type)->create($values); $operation = 'create'; }