diff --git a/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php
index 445138d475..b18bf3d0b0 100644
--- a/core/modules/comment/src/Form/CommentAdminOverview.php
+++ b/core/modules/comment/src/Form/CommentAdminOverview.php
@@ -270,10 +270,10 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
if ($operation != 'delete') {
foreach ($comments as $comment) {
if ($operation == 'unpublish') {
- $comment->setPublished(FALSE);
+ $comment->setUnpublished();
}
elseif ($operation == 'publish') {
- $comment->setPublished(TRUE);
+ $comment->setPublished();
}
$comment->save();
}
diff --git a/core/modules/comment/src/Form/ConfirmDeleteMultiple.php b/core/modules/comment/src/Form/ConfirmDeleteMultiple.php
index 3752ddd661..1be7a68c15 100644
--- a/core/modules/comment/src/Form/ConfirmDeleteMultiple.php
+++ b/core/modules/comment/src/Form/ConfirmDeleteMultiple.php
@@ -115,7 +115,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
}
$items[$default_key] = [
'label' => [
- '#markup' => $this->t('@label (Original translation) - The following content translations will be deleted:', ['@label' => $node->label()]),
+ '#markup' => $this->t('@label (Original translation) - The following comment translations will be deleted:', ['@label' => $comment->label()]),
],
'deleted_translations' => [
'#theme' => 'item_list',
diff --git a/core/modules/comment/src/Plugin/Action/DeleteComment.php b/core/modules/comment/src/Plugin/Action/DeleteComment.php
index 7f5651655a..675b021809 100644
--- a/core/modules/comment/src/Plugin/Action/DeleteComment.php
+++ b/core/modules/comment/src/Plugin/Action/DeleteComment.php
@@ -45,6 +45,8 @@ class DeleteComment extends ActionBase implements ContainerFactoryPluginInterfac
* The plugin implementation definition.
* @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
+ * @param \Drupal\Core\Session\AccountInterface $current_user
+ * The current user.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, PrivateTempStoreFactory $temp_store_factory, AccountInterface $current_user) {
$this->currentUser = $current_user;
diff --git a/core/modules/comment/src/Plugin/views/field/CommentedEntity.php b/core/modules/comment/src/Plugin/views/field/CommentedEntity.php
index 1f92b70434..9e0d64b23e 100644
--- a/core/modules/comment/src/Plugin/views/field/CommentedEntity.php
+++ b/core/modules/comment/src/Plugin/views/field/CommentedEntity.php
@@ -2,7 +2,7 @@
namespace Drupal\comment\Plugin\views\field;
-use Drupal\views\Plugin\views\field\Field;
+use Drupal\views\Plugin\views\field\EntityField;
use Drupal\views\ResultRow;
/**
@@ -10,7 +10,7 @@
*
* @ViewsField("commented_entity")
*/
-class CommentedEntity extends Field {
+class CommentedEntity extends EntityField {
/**
* Array of entities that has comments.
diff --git a/core/modules/comment/src/Tests/CommentAdminTest.php b/core/modules/comment/src/Tests/CommentAdminTest.php
index 8bd768d9e2..b881ac2221 100644
--- a/core/modules/comment/src/Tests/CommentAdminTest.php
+++ b/core/modules/comment/src/Tests/CommentAdminTest.php
@@ -2,7 +2,7 @@
namespace Drupal\comment\Tests;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Utility\Html;
use Drupal\user\RoleInterface;
use Drupal\comment\Entity\Comment;
@@ -104,10 +104,10 @@ public function testApprovalAdminInterface() {
$this->drupalGet('admin/content/comment');
$this->postComment($this->node, $this->randomMachineName());
$this->drupalGet('admin/content/comment');
- $this->assertText(SafeMarkup::checkPlain($this->node->label()));
- $this->node->setPublished(FALSE)->save();
+ $this->assertText(Html::escape($this->node->label()));
+ $this->node->setPublished()->save();
$this->drupalGet('admin/content/comment');
- $this->assertNoText(SafeMarkup::checkPlain($this->node->label()));
+ $this->assertNoText(Html::escape($this->node->label()));
}
/**
diff --git a/core/modules/comment/src/Tests/Update/CommentAdminViewUpdateTest.php b/core/modules/comment/src/Tests/Update/CommentAdminViewUpdateTest.php
index 930c152add..87f8f23a09 100644
--- a/core/modules/comment/src/Tests/Update/CommentAdminViewUpdateTest.php
+++ b/core/modules/comment/src/Tests/Update/CommentAdminViewUpdateTest.php
@@ -3,7 +3,6 @@
namespace Drupal\comment\Tests\Update;
use Drupal\system\Tests\Update\UpdatePathTestBase;
-use Drupal\user\Entity\User;
/**
* Tests that comment admin view is enabled after update.
diff --git a/core/modules/comment/src/Tests/Views/CommentAdminTest.php b/core/modules/comment/src/Tests/Views/CommentAdminTest.php
index 9097a26e32..ea868a7b21 100644
--- a/core/modules/comment/src/Tests/Views/CommentAdminTest.php
+++ b/core/modules/comment/src/Tests/Views/CommentAdminTest.php
@@ -7,8 +7,8 @@
use Drupal\comment\Entity\Comment;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Component\Render\FormattableMarkup;
-use Drupal\Component\Render\HtmlEscapedText;
use Drupal\comment\Tests\CommentTestBase as CommentWebTestBase;
+use Drupal\Component\Utility\Html;
use Drupal\user\RoleInterface;
use Drupal\views\Views;
@@ -123,11 +123,11 @@ public function testApprovalAdminInterface() {
$this->drupalLogout();
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/content/comment');
- $this->assertText(new HtmlEscapedText($this->node->label()), 'Comment admin can see the title of a published node');
- $this->node->setPublished(FALSE)->save();
+ $this->assertText(Html::escape($this->node->label()), 'Comment admin can see the title of a published node');
+ $this->node->setUnpublished()->save();
$this->assertFalse($this->node->isPublished(), 'Node is unpublished now.');
$this->drupalGet('admin/content/comment');
- $this->assertNoText(new HtmlEscapedText($this->node->label()), 'Comment admin cannot see the title of an unpublished node');
+ $this->assertNoText(Html::escape($this->node->label()), 'Comment admin cannot see the title of an unpublished node');
$this->drupalLogout();
$node_access_user = $this->drupalCreateUser([
'administer comments',
@@ -135,7 +135,7 @@ public function testApprovalAdminInterface() {
]);
$this->drupalLogin($node_access_user);
$this->drupalGet('admin/content/comment');
- $this->assertText(new HtmlEscapedText($this->node->label()), 'Comment admin with bypass node access permissions can still see the title of a published node');
+ $this->assertText(Html::escape($this->node->label()), 'Comment admin with bypass node access permissions can still see the title of a published node');
}
/**
@@ -169,11 +169,11 @@ public function testCommentedEntityLabel() {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/content/comment');
// Admin page contains label of both entities.
- $this->assertText(new HtmlEscapedText($this->node->label()), 'Node title is visible.');
- $this->assertText(new HtmlEscapedText($block_content->label()), 'Block content label is visible.');
+ $this->assertText(Html::escape($this->node->label()), 'Node title is visible.');
+ $this->assertText(Html::escape($block_content->label()), 'Block content label is visible.');
// Admin page contains subject of both entities.
- $this->assertText(new HtmlEscapedText($node_comment->label()), 'Node comment is visible.');
- $this->assertText(new HtmlEscapedText($block_content_comment->label()), 'Block content comment is visible.');
+ $this->assertText(Html::escape($node_comment->label()), 'Node comment is visible.');
+ $this->assertText(Html::escape($block_content_comment->label()), 'Block content comment is visible.');
}
}