diff --git a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php index ff0f5ac..9632c18 100644 --- a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php +++ b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php @@ -116,7 +116,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { $element['thread_depth'] = [ '#type' => 'number', '#title' => $this->t('Thread depth limit'), - '#default_value' => ($settings['thread_depth']) ? $settings['thread_depth'] : CommentManagerInterface::COMMENT_MAX_THREAD_DEPTH, + '#default_value' => $settings['thread_depth'], '#description' => $this->t('Define comment thread depth.'), '#required' => TRUE, '#min' => 1, diff --git a/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php b/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php index 9db1221..374fd75 100644 --- a/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php +++ b/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php @@ -78,10 +78,14 @@ public function testPublishedEntityKey() { * @see comment_update_8500() */ public function testCommentUpdate8500() { + // Grab all existing comment field configs. $entity_query = \Drupal::entityQuery('field_config'); $entity_query->condition('field_type', 'comment'); $results = $entity_query->execute(); + // Confirm there are existing comment field configs. + $this->assertNotEmpty($results, t('Unable to grab existing comment field configs or none exist.')); + // Check that none of the existing comment fields have the thread_depth setting. /** @var \Drupal\field\FieldConfigStorage $field_config_storage */ $field_config_storage = \Drupal::entityTypeManager()->getStorage('field_config'); @@ -94,10 +98,14 @@ public function testCommentUpdate8500() { // Run updates. $this->runUpdates(); + // Grab all existing comment field configs. $entity_query = \Drupal::entityQuery('field_config'); $entity_query->condition('field_type', 'comment'); $results = $entity_query->execute(); + // Confirm there are existing comment field configs. + $this->assertNotEmpty($results, t('Unable to grab existing comment field configs or none exist.')); + // Check that all existing comment fields have the thread_depth setting after the update. /** @var \Drupal\field\FieldConfigStorage $field_config_storage */ $field_config_storage = \Drupal::entityTypeManager()->getStorage('field_config');