From 3e1a88871169787c5c47e7a4aec4aa921a2680d3 Mon Sep 17 00:00:00 2001 From: JeroenT Date: Sat, 24 Sep 2022 14:19:59 +0000 Subject: [PATCH] Issue #3279991: drupal_entity_form add support for content moderation --- src/TwigTweakExtension.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TwigTweakExtension.php b/src/TwigTweakExtension.php index 00671bb..6817c14 100644 --- a/src/TwigTweakExtension.php +++ b/src/TwigTweakExtension.php @@ -183,7 +183,8 @@ class TwigTweakExtension extends AbstractExtension { */ public static function drupalEntityForm(string $entity_type, ?string $id = NULL, string $form_mode = 'default', array $values = [], bool $check_access = TRUE): array { $entity_storage = \Drupal::entityTypeManager()->getStorage($entity_type); - $entity = $id ? $entity_storage->load($id) : $entity_storage->create($values); + $entity_repository = \Drupal::service('entity.repository'); + $entity = $id ? $entity_repository->getActive($entity_type, $id) : $entity_storage->create($values); if ($entity) { return \Drupal::service('twig_tweak.entity_form_view_builder') ->build($entity, $form_mode, $check_access);