diff --git a/core/modules/entity/src/Tests/EntityDisplayTest.php b/core/modules/entity/src/Tests/EntityDisplayTest.php index f0c8e0c..1fa6341 100644 --- a/core/modules/entity/src/Tests/EntityDisplayTest.php +++ b/core/modules/entity/src/Tests/EntityDisplayTest.php @@ -296,7 +296,7 @@ public function testRenameDeleteBundle() { $expected_dependencies = array( 'entity' => array('field.instance.node.article_rename.body', 'node.type.article_rename'), - 'module' => array('text') + 'module' => array('text', 'user') ); // Check that the display has dependencies on the bundle, fields and the // modules that provide the formatters. diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php index c904b08..bdb45a5 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php @@ -128,9 +128,11 @@ public function testSupportedEntityTypesAndWidgets() { // Test all the other widgets supported by the entity reference field. // Since we don't know the form structure for these widgets, just test // that editing and saving an already created entity works. + // Also exclude the special author reference widgets. + $exclude = array('entity_reference_autocomplete', 'entity_reference_autocomplete_tags', 'route_based_autocomplete', 'author_autocomplete'); $entity = current(entity_load_multiple_by_properties($this->entityType, array('name' => $entity_name))); $supported_widgets = \Drupal::service('plugin.manager.field.widget')->getOptions('entity_reference'); - $supported_widget_types = array_diff(array_keys($supported_widgets), array('entity_reference_autocomplete', 'entity_reference_autocomplete_tags')); + $supported_widget_types = array_diff(array_keys($supported_widgets), $exclude); foreach ($supported_widget_types as $widget_type) { entity_get_form_display($this->entityType, $this->bundle, 'default')->setComponent($this->fieldName, array( diff --git a/core/modules/user/src/Plugin/Field/FieldWidget/AuthorAutocompleteWidget.php b/core/modules/user/src/Plugin/Field/FieldWidget/AuthorAutocompleteWidget.php index 107f0e6..43834df 100644 --- a/core/modules/user/src/Plugin/Field/FieldWidget/AuthorAutocompleteWidget.php +++ b/core/modules/user/src/Plugin/Field/FieldWidget/AuthorAutocompleteWidget.php @@ -30,7 +30,7 @@ class AuthorAutocompleteWidget extends RouteBasedAutocompleteWidget { public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) { $element = parent::formElement($items, $delta, $element, $form, $form_state); - $element['target_id']['#default_value'] = $items[$delta]->entity->isAuthenticated() ? $items[$delta]->entity->getUsername() : ''; + $element['target_id']['#default_value'] = $items[$delta]->entity && $items[$delta]->entity->isAuthenticated() ? $items[$delta]->entity->getUsername() : ''; $user_config = \Drupal::config('user.settings'); $element['target_id']['#description'] = $this->t('Leave blank for %anonymous.', array('%anonymous' => $user_config->get('anonymous')));