From eff02c9d31fb52a660cb44f7daccd95b88afd28b Mon Sep 17 00:00:00 2001 From: Jeroen Tubex <19699-JeroenT@users.noreply.drupalcode.org> Date: Sun, 25 Sep 2022 10:04:14 +0500 Subject: [PATCH] Issue #3279991 by JeroenT, Chi: drupal_entity_form add support for content moderation --- src/TwigExtension.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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'; }