Browse Source

Issue #3279991 by JeroenT, Chi: drupal_entity_form add support for content moderation

8.x-2.x
Jeroen Tubex 2 years ago committed by Chi
parent
commit
eff02c9d31
  1. 5
      src/TwigExtension.php

5
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';
}

Loading…
Cancel
Save