Skip to content
Snippets Groups Projects
Commit 82d44b78 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2016177 followup by yched: Refactor 'autocreate entity' handling from entity_reference().

parent fa6444e0
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -107,7 +107,7 @@ function entity_reference_field_is_empty($item, $field) {
*/
function entity_reference_field_presave(EntityInterface $entity, $field, $instance, $langcode, &$items) {
foreach ($items as $delta => $item) {
if (empty($item['target_id']) && !empty($item['entity']) &&$item['entity']->isNew()) {
if (empty($item['target_id']) && !empty($item['entity']) && $item['entity']->isNew()) {
$item['entity']->save();
$items[$delta]['target_id'] = $item['entity']->id();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment