diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index 4fca5bb..0ab0897 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -5,10 +5,6 @@ * Install, update and uninstall functions for the Comment module. */ -use Drupal\node\Plugin\Core\Entity\Node; -use Drupal\comment\Plugin\Core\Entity\Comment; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\CoreBundle; use Drupal\Core\Language\Language; /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index fd03a6e..c6e0c88 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -612,20 +612,18 @@ function comment_get_recent($number = 10) { $query->addMetaData('base_table', 'comment'); $query->fields('c') ->condition('c.status', COMMENT_PUBLISHED); - if (module_exists('node')) { + if (Drupal::moduleHandler()->moduleExists('node')) { // Special case to filter by published content. - $query->leftJoin('node_field_data', 'n', "n.nid = c.entity_id AND c.entity_type = 'node'"); + $query->innerJoin('node_field_data', 'n', "n.nid = c.entity_id AND c.entity_type = 'node'"); $query->addTag('node_access'); // @todo This should be actually filtering on the desired node status field // language and just fall back to the default language. - $query->condition(db_or() - ->condition('n.default_langcode', 1) + $query ->condition('n.status', NODE_PUBLISHED) - ->orderBy('c.created', 'DESC') - ->isNull('n.status') - ); + ->condition('n.default_langcode', 1); } - $comments = $query->orderBy('c.created', 'DESC') + $comments = $query + ->orderBy('c.created', 'DESC') // Additionally order by cid to ensure that comments with the same timestamp // are returned in the exact order posted. ->orderBy('c.cid', 'DESC') diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc index a0635bf..a1284e4 100644 --- a/core/modules/comment/comment.pages.inc +++ b/core/modules/comment/comment.pages.inc @@ -149,26 +149,3 @@ function comment_approve(Comment $comment) { } throw new NotFoundHttpException(); } - -/** - * Page callback: Legacy handler to redirect old comment reply urls to new url. - * - * @param \Drupal\node\Plugin\Core\Entity\Node $node - * The node to which the comments are attached. - * @param int $pid - * (optional) Some comments are replies to other comments. In those cases, - * $pid is the parent comment's comment ID. Defaults to NULL. - * - * @throw \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - * When there are no comment fields attached to the node. - */ -function comment_node_redirect(Node $node, $pid = NULL) { - $fields = comment_get_comment_fields('node'); - foreach ($fields as $field_name => $detail) { - // Pick the first comment field found on the node. - if (in_array($node->bundle(), $detail['bundles']['node'], TRUE)) { - drupal_goto('comment/reply/node/' . $node->id() . '/' . $field_name); - } - } - throw new NotFoundHttpException(); -} diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php b/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php index 4a4ad75..4b08f37 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php @@ -27,7 +27,7 @@ class CommentDefaultFormatter extends FormatterBase { /** - * Implements \Drupal\field\Plugin\Type\Formatter\FormatterInterface::viewElements(). + * {@inheritdoc} */ public function viewElements(EntityInterface $entity, $langcode, array $items) { $elements = array(); diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/field/widget/CommentWidget.php b/core/modules/comment/lib/Drupal/comment/Plugin/field/widget/CommentWidget.php index 2a44469..ba664cd 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/field/widget/CommentWidget.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/field/widget/CommentWidget.php @@ -26,7 +26,7 @@ class CommentWidget extends WidgetBase { /** - * Implements \Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement(). + * {@inheritdoc} */ public function formElement(array $items, $delta, array $element, $langcode, array &$form, array &$form_state) { $field = $this->field; diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/EntityLink.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/EntityLink.php index 3e240fa..dbb00d1 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/EntityLink.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/EntityLink.php @@ -8,17 +8,14 @@ namespace Drupal\comment\Plugin\views\field; use Drupal\views\Plugin\views\field\FieldPluginBase; -use Drupal\Component\Annotation\Plugin; +use Drupal\Component\Annotation\PluginID; /** * Handler for showing comment module's entity links. * * @ingroup views_field_handlers * - * @Plugin( - * id = "comment_entity_link", - * module = "comment" - * ) + * @PluginID("comment_entity_link") */ class EntityLink extends FieldPluginBase { diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php index a35d54d..e1c395b 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php @@ -93,8 +93,7 @@ function testCommentLinks() { * USER_REGISTER_VISITORS. * - contact: COMMENT_ANONYMOUS_MAY_CONTACT or * COMMENT_ANONYMOUS_MAYNOT_CONTACT. - * - comments: COMMENT_OPEN, COMMENT_CLOSED, or - * COMMENT_HIDDEN. + * - comments: COMMENT_OPEN, COMMENT_CLOSED, or COMMENT_HIDDEN. * - User permissions: * These are granted or revoked for the user, according to the * 'authenticated' flag above. Pass 0 or 1 as parameter values. See diff --git a/core/modules/comment/lib/Drupal/comment/Type/CommentItem.php b/core/modules/comment/lib/Drupal/comment/Type/CommentItem.php index 6cc059b..8a5d616 100644 --- a/core/modules/comment/lib/Drupal/comment/Type/CommentItem.php +++ b/core/modules/comment/lib/Drupal/comment/Type/CommentItem.php @@ -24,7 +24,7 @@ class CommentItem extends FieldItemBase { static $propertyDefinitions; /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions(). + * {@inheritdoc} */ public function getPropertyDefinitions() {