From a97d47eb49173afc4af3218de547ca9a166fda46 Mon Sep 17 00:00:00 2001 From: JeroenT Date: Wed, 11 May 2022 17:40:56 +0000 Subject: [PATCH] Update src/TwigExtension.php --- src/TwigExtension.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/TwigExtension.php b/src/TwigExtension.php index 4ccbfc0..3ea99c5 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'; }