diff --git a/core/modules/comment/config/views.view.comments.yml b/core/modules/comment/config/views.view.comments.yml index 15c93d6..2b3dedd 100644 --- a/core/modules/comment/config/views.view.comments.yml +++ b/core/modules/comment/config/views.view.comments.yml @@ -1433,18 +1433,13 @@ display: header: { } footer: { } empty: - area: - id: area + area_text_custom: + id: area_text_custom table: views - field: area - relationship: none - group_type: group - admin_label: '' + field: area_text_custom empty: '1' - content: "

No comments available.

\n" - format: basic_html - tokenize: '0' - plugin_id: text + content: 'No comments available.' + plugin_id: text_custom arguments: { } label: Comments module: views diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php index 4e6ca4c..0e0b5b2 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php @@ -232,4 +232,5 @@ public function getChildCids(array $comments) { ->execute() ->fetchCol(); } + } diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php index 23f9408..d22dccb 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php @@ -47,7 +47,19 @@ function render($values) { return $this->renderLink($comment, $values); } - function renderLink($comment, $values) { + /** + * Renders the comment action link in the view. + * + * @param \Drupal\comment\CommentInterface $comment + * Comment entity. + * @param array $values + * Array of values of the view row. + * + * @return string + * Rendered text to display. + * + */ + public function renderLink($comment, $values) { $text = !empty($this->options['text']) ? $this->options['text'] : t('view'); $nid = $comment->nid->value; $cid = $comment->id(); diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkApprove.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkApprove.php index 8e992c6..aa29571 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkApprove.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkApprove.php @@ -23,7 +23,10 @@ public function access() { return user_access('administer comments'); } - function renderLink($comment, $values) { + /** + * {@inheritdoc} + */ + public function renderLink($comment, $values) { // Don't show an approve link on published nodes. if ($comment->status->value == COMMENT_PUBLISHED) { return; diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkDelete.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkDelete.php index fef5f23..dad4c39 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkDelete.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkDelete.php @@ -23,7 +23,10 @@ public function access() { return user_access('administer comments'); } - function renderLink($comment, $values) { + /** + * {@inheritdoc} + */ + public function renderLink($comment, $values) { // Ensure user has access to edit this comment. if (!$comment->access('delete')) { return; diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php index 1e6b624..28abc82 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php @@ -42,8 +42,10 @@ public function access() { return user_access('administer comments'); } - - function renderLink($comment, $values) { + /** + * {@inheritdoc} + */ + public function renderLink($comment, $values) { parent::renderLink($comment, $values); // Ensure user has access to edit this comment. if (!$comment->access('update')) { diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkReply.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkReply.php index 9223682..bd58653 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkReply.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkReply.php @@ -23,7 +23,10 @@ public function access() { return user_access('post comments'); } - function renderLink($comment, $values) { + /** + * {@inheritdoc} + */ + public function renderLink($comment, $values) { $text = !empty($this->options['text']) ? $this->options['text'] : t('reply'); $this->options['alter']['make_link'] = TRUE; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php index 1e2576a..24c12b2 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php @@ -19,6 +19,13 @@ class CommentActionsTest extends CommentTestBase { */ public static $modules = array('dblog', 'action'); + /** + * The entity manager. + * + * @var \Drupal\Core\Entity\EntityManager + */ + protected $manager; + public static function getInfo() { return array( 'name' => 'Comment actions', @@ -27,22 +34,30 @@ public static function getInfo() { ); } + function setUp() { + parent::setUp(); + + $this->manager = $this->container->get('plugin.manager.entity'); + } + /** * Tests comment publish and unpublish actions. */ - function testCommentPublishUnpublishActions() { + public function testCommentPublishUnpublishActions() { $this->drupalLogin($this->web_user); $comment_text = $this->randomName(); $subject = $this->randomName(); $comment = $this->postComment($this->node, $comment_text, $subject); // Unpublish a comment. - $action = entity_load('action', 'comment_unpublish_action'); + $actions = $this->manager->getStorageController('action')->load(array('comment_unpublish_action')); + $action = reset($actions); $action->execute(array($comment)); $this->assertEqual($comment->status->value, COMMENT_NOT_PUBLISHED, 'Comment was unpublished'); // Publish a comment. - $action = entity_load('action', 'comment_publish_action'); + $actions = $this->manager->getStorageController('action')->load(array('comment_publish_action')); + $action = reset($actions); $action->execute(array($comment)); $this->assertEqual($comment->status->value, COMMENT_PUBLISHED, 'Comment was published'); } @@ -50,11 +65,11 @@ function testCommentPublishUnpublishActions() { /** * Tests the unpublish comment by keyword action. */ - function testCommentUnpublishByKeyword() { + public function testCommentUnpublishByKeyword() { $this->drupalLogin($this->admin_user); $keyword_1 = $this->randomName(); $keyword_2 = $this->randomName(); - $action = entity_create('action', array( + $action = $this->manager->getStorageController('action')->create(array( 'id' => 'comment_unpublish_by_keyword_action', 'label' => $this->randomName(), 'type' => 'comment', @@ -68,7 +83,7 @@ function testCommentUnpublishByKeyword() { $comment = $this->postComment($this->node, $keyword_2, $this->randomName()); // Load the full comment so that status is available. - $comment = comment_load($comment->id()); + $this->manager->getStorageController('comment')->load(array($comment->id())); $this->assertTrue($comment->status->value == COMMENT_PUBLISHED, 'The comment status was set to published.'); @@ -79,18 +94,19 @@ function testCommentUnpublishByKeyword() { /** * Tests comment delete action. */ - function testCommentDeleteAction() { + public function testCommentDeleteAction() { $this->drupalLogin($this->admin_user); $comment_text = $this->randomName(); $subject = $this->randomName(); $comment = $this->postComment($this->node, $comment_text, $subject); // Delete a comment. - $action = entity_load('action', 'comment_delete_action'); + $actions = $this->manager->getStorageController('action')->load(array('comment_delete_action')); + $action = reset($actions); $action->execute(array($comment)); // Try to load the comment again. - $comment = comment_load($comment->id()); + $comment = $this->manager->getStorageController('comment')->load(array($comment->id())); $this->assertTrue(empty($comment), 'Comment was deleted'); } diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php index 556f16a..d797f3e 100644 --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; use Drupal\views\ViewExecutable; +use Drupal\Component\Utility\Unicode; /** * Tests for views default views. @@ -58,7 +59,7 @@ protected function setUp() { $this->vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => $this->randomName(), 'description' => $this->randomName(), - 'vid' => drupal_strtolower($this->randomName()), + 'vid' => Unicode::strtolower($this->randomName()), 'langcode' => Language::LANGCODE_NOT_SPECIFIED, 'help' => '', 'nodes' => array('page' => 'page'), @@ -67,7 +68,7 @@ protected function setUp() { $this->vocabulary->save(); // Setup a field and instance. - $field_name = drupal_strtolower($this->randomName()); + $field_name = Unicode::strtolower($this->randomName()); entity_create('field_entity', array( 'field_name' => $field_name, 'type' => 'taxonomy_term_reference', @@ -126,6 +127,9 @@ protected function setUp() { /** * Returns a new term with random properties in vocabulary $vid. + * + * @return \Drupal\taxonomy\TermInterface + * Taxonomy term created. */ function createTerm() { $filter_formats = filter_formats();