|
|
@ -623,13 +623,12 @@ class TwigExtension extends AbstractExtension { |
|
|
|
* The processed form for the given entity type and form mode. |
|
|
|
* 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) { |
|
|
|
public function drupalEntityForm($entity_type, $id = NULL, $form_mode = 'default', array $values = [], $check_access = TRUE) { |
|
|
|
$entity_storage = \Drupal::entityTypeManager()->getStorage($entity_type); |
|
|
|
|
|
|
|
if ($id) { |
|
|
|
if ($id) { |
|
|
|
$entity = $entity_storage->load($id); |
|
|
|
$entity = \Drupal::service('entity.repository')->getActive($entity_type, $id); |
|
|
|
$operation = 'update'; |
|
|
|
$operation = 'update'; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
$entity = $entity_storage->create($values); |
|
|
|
$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->create($values); |
|
|
|
$operation = 'create'; |
|
|
|
$operation = 'create'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|