diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php index 32d22b1..b12c674 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php @@ -96,8 +96,7 @@ public function formElement(FieldInterface $items, $delta, array $element, array '#size' => $this->getSetting('size'), '#placeholder' => $this->getSetting('placeholder'), '#element_validate' => array(array($this, 'elementValidate')), - // @todo: Use wrapper to get the user if exists or needed. - '#autocreate_uid' => isset($entity->uid) ? $entity->uid : $user->id(), + '#autocreate_uid' => ($entity instanceof EntityAuthorInterface) ? $entity->getAuthorId() : $user->id(), ); return array('target_id' => $element);