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

8.0.x
Alex Pott 2013-06-15 01:02:26 +02:00
parent fa6444e067
commit 82d44b7834
1 changed files with 1 additions and 1 deletions

View File

@ -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();
}