only in patch2: unchanged: --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -858,8 +858,6 @@ function form_select_options($element, $choices = NULL) { // isset() fails in this situation. $value_valid = isset($element['#value']) || array_key_exists('#value', $element); $value_is_array = $value_valid && is_array($element['#value']); - // Check if the element is multiple select and no value has been selected. - $empty_value = (empty($element['#value']) && !empty($element['#multiple'])); $options = ''; foreach ($choices as $key => $choice) { if (is_array($choice)) { @@ -872,8 +870,7 @@ function form_select_options($element, $choices = NULL) { } else { $key = (string) $key; - $empty_choice = $empty_value && $key == '_none'; - if ($value_valid && ((!$value_is_array && (string) $element['#value'] === $key || ($value_is_array && in_array($key, $element['#value']))) || $empty_choice)) { + if ($value_valid && (!$value_is_array && (string) $element['#value'] === $key || ($value_is_array && in_array($key, $element['#value'])))) { $selected = ' selected="selected"'; } else { only in patch2: unchanged: --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -436,13 +436,6 @@ function comment_entity_view(EntityInterface $entity, EntityViewDisplayInterface // http://drupal.org/node/1901110 return; } - if ($view_mode == 'search_index' || $view_mode == 'search_result' || $view_mode == 'print') { - // Do not add any links if the entity displayed for: - // - search indexing. - // - constructing a search result excerpt. - // - print. - return; - } $fields = \Drupal::service('comment.manager')->getFields('node'); foreach ($fields as $field_name => $detail) { // Skip fields that entity does not have. @@ -521,9 +514,11 @@ function comment_entity_view(EntityInterface $entity, EntityViewDisplayInterface } } } - else { + elseif ($view_mode != 'search_index' && $view_mode != 'search_result') { // Entity in other view modes: add a "post comment" link if the user is // allowed to post comments and if this entity is allowing new comments. + // But we don't want this link if we're building the entity for search + // indexing or constructing a search result excerpt. if ($commenting_status == COMMENT_OPEN) { $comment_form_location = $instance->getSetting('form_location'); if (user_access('post comments')) { only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php @@ -143,8 +143,8 @@ public function viewElements(FieldItemListInterface $items) { } // Append comment form if the comments are open and the form is set to - // display below the entity. Do not show the form for the print view mode. - if ($status == COMMENT_OPEN && $comment_settings['form_location'] == COMMENT_FORM_BELOW && $this->viewMode != 'print') { + // display below the entity. + if ($status == COMMENT_OPEN && $comment_settings['form_location'] == COMMENT_FORM_BELOW) { // Only show the add comment form if the user has permission. if ($this->currentUser->hasPermission('post comments')) { // All users in the "anonymous" role can use the same form: it is fine only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentBookTest.php +++ /dev/null @@ -1,84 +0,0 @@ - 'Book commenting', - 'description' => 'Test visibility of comments on book pages.', - 'group' => 'Book', - ); - } - - function setUp() { - parent::setUp(); - - // Create comment field on book. - \Drupal::service('comment.manager')->addDefaultField('node', 'book'); - } - - /** - * Tests comments in book export. - */ - public function testBookCommentPrint() { - $book_node = entity_create('node', array( - 'type' => 'book', - 'title' => 'Book title', - 'body' => 'Book body', - )); - $book_node->book['bid'] = 'new'; - $book_node->save(); - - $comment_subject = $this->randomName(8); - $comment_body = $this->randomName(8); - $comment = entity_create('comment', array( - 'subject' => $comment_subject, - 'comment_body' => $comment_body, - 'entity_id' => $book_node->id(), - 'entity_type' => 'node', - 'field_name' => 'comment', - 'status' => CommentInterface::PUBLISHED, - )); - $comment->save(); - - $commenting_user = $this->drupalCreateUser(array('access printer-friendly version', 'access comments', 'post comments')); - $this->drupalLogin($commenting_user); - - $this->drupalGet('node/' . $book_node->id()); - - $this->assertText($comment_subject, 'Comment subject found'); - $this->assertText($comment_body, 'Comment body found'); - $this->assertText(t('Add new comment'), 'Comment form found'); - $this->assertField('subject', 'Comment form subject found'); - - $this->drupalGet('book/export/html/' . $book_node->id()); - - $this->assertText(t('Comments'), 'Comment thread found'); - $this->assertText($comment_subject, 'Comment subject found'); - $this->assertText($comment_body, 'Comment body found'); - - $this->assertNoText(t('Add new comment'), 'Comment form not found'); - $this->assertNoField('subject', 'Comment form subject not found'); - } - -} only in patch2: unchanged: --- a/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php +++ b/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php @@ -378,7 +378,6 @@ function testSelectListMultiple() { // Display form: with no field data, nothing is selected. $this->drupalGet('entity_test/manage/' . $entity->id()); - $this->assertOptionSelected("edit-card-2", '_none'); $this->assertNoOptionSelected('edit-card-2', 0); $this->assertNoOptionSelected('edit-card-2', 1); $this->assertNoOptionSelected('edit-card-2', 2); only in patch2: unchanged: --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php @@ -87,9 +87,7 @@ function testTaxonomyTermFieldMultipleVocabularies() { // Submit an entity with both terms. $this->drupalGet('entity_test/add'); - // Just check if the widget for the select is displayed, the NULL value is - // used to ignore the value check. - $this->assertFieldByName("{$this->field_name}[]", NULL, 'Widget is displayed.'); + $this->assertFieldByName("{$this->field_name}[]", '', 'Widget is displayed.'); $edit = array( 'user_id' => mt_rand(0, 10), 'name' => $this->randomName(), @@ -127,9 +125,7 @@ function testTaxonomyTermFieldMultipleVocabularies() { // The widget should still be displayed. $this->drupalGet('entity_test/add'); - // Just check if the widget for the select is displayed, the NULL value is - // used to ignore the value check. - $this->assertFieldByName("{$this->field_name}[]", NULL, 'Widget is still displayed.'); + $this->assertFieldByName("{$this->field_name}[]", '', 'Widget is still displayed.'); // Term 1 should still pass validation. $edit = array(