diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php index bf4bbb4..299780a 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php @@ -70,7 +70,7 @@ public function preSave() { $entity = $this->get('entity')->getValue(); $target_id = $this->get('target_id')->getValue(); - if (empty($target_id) && !empty($entity) && $entity->isNew()) { + if ($target_id === NULL && !empty($entity) && $entity->isNew()) { $entity->save(); $this->set('target_id', $entity->id()); } diff --git a/core/modules/field/field.module b/core/modules/field/field.module index c3e056d..92f8819 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -127,17 +127,21 @@ function field_help($path, $arg) { $field_widgets = \Drupal::service('plugin.manager.field.widget')->getDefinitions(); $field_types = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions(); foreach (array_merge($field_types, $field_widgets) as $field_module) { - $modules[] = $field_module['provider']; + $providers[] = $field_module['provider']; } - $modules = array_unique($modules); - sort($modules); - foreach ($modules as $module) { - $display = $info[$module]['name']; - if (\Drupal::moduleHandler()->implementsHook($module, 'help')) { - $items[] = l($display, 'admin/help/' . $module); - } - else { - $items[] = $display; + $providers = array_unique($providers); + sort($providers); + foreach ($providers as $provider) { + // @todo: Throws notices because the owner of field types in + // \Drupal\Core\Entity is 'Core'. + if (isset($info[$provider]['name'])) { + $display = $info[$provider]['name']; + if (\Drupal::moduleHandler()->implementsHook($provider, 'help')) { + $items[] = l($display, 'admin/help/' . $provider); + } + else { + $items[] = $display; + } } } $item_list = array( diff --git a/core/modules/user/lib/Drupal/user/Entity/User.php b/core/modules/user/lib/Drupal/user/Entity/User.php index d8dc8e4..693751e 100644 --- a/core/modules/user/lib/Drupal/user/Entity/User.php +++ b/core/modules/user/lib/Drupal/user/Entity/User.php @@ -58,6 +58,14 @@ public function id() { /** * {@inheritdoc} */ + public function isNew() { + // ID 0 does not imply a new user. + return !empty($this->enforceIsNew) || $this->id() === NULL; + } + + /** + * {@inheritdoc} + */ static function preCreate(EntityStorageControllerInterface $storage_controller, array &$values) { parent::preCreate($storage_controller, $values);