diff --git a/core/modules/comment/config/schema/comment.schema.yml b/core/modules/comment/config/schema/comment.schema.yml index b5bcd86..47965e2 100644 --- a/core/modules/comment/config/schema/comment.schema.yml +++ b/core/modules/comment/config/schema/comment.schema.yml @@ -97,18 +97,9 @@ field.comment.field_settings: type: mapping label: 'Comment settings' mapping: - default_mode: - type: integer - label: 'Threading' - per_page: - type: integer - label: 'Comments per page' anonymous: type: integer label: 'Mode' - form_location: - type: boolean - label: ' Allow comment title' preview: type: integer label: 'Preview comment' diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php index 009b294..f2c3ebe 100644 --- a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php +++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php @@ -360,8 +360,8 @@ protected function buildLinks(FieldItemListInterface $items) { 'value' => $entity->url('canonical', $options), ); } - elseif ($link_style == static::LINKS_PAGE) { - // Default links: display the number of comments that have been posted, + elseif ($link_style == static::LINKS_TEASER) { + // Teaser style links: display the number of comments that have been posted, // or a link to add new comments if the user has permission, the entity // is open to new comments, and there currently are none. if ($this->currentUser->hasPermission('access comments')) { @@ -418,9 +418,8 @@ protected function buildLinks(FieldItemListInterface $items) { } } else { - // Teaser style links - Node in other view modes: add a "post comment" - // link if the user is allowed to post comments and if this node is - // allowing new comments. + // Default links: add a "post comment" link if the user is allowed to + // post comments and if this node is allowing new comments. if ($commenting_status == CommentItemInterface::OPEN) { $comment_form_location = $this->getSetting('form_location'); if ($this->currentUser->hasPermission('post comments')) { @@ -460,10 +459,11 @@ protected function buildLinks(FieldItemListInterface $items) { '#links' => $links, '#attributes' => array('class' => array('links', 'inline')), ); - if ($link_style == static::LINKS_TEASER && $this->moduleHandler->moduleExists('history') && $this->currentUser->isAuthenticated()) { - if ($entity->getEntityTypeId() == 'node') { - $build['comment__' . $field_name]['#attached']['library'][] = 'comment/drupal.node-new-comments-link'; - } + if ($link_style == static::LINKS_TEASER && $this->moduleHandler->moduleExists('history') && $this->currentUser->isAuthenticated() + // @todo revisit this condition when history.module is generalized; + // see https://www.drupal.org/node/2081585. + && $entity->getEntityTypeId() == 'node') { + $build['comment__' . $field_name]['#attached']['library'][] = 'comment/drupal.node-new-comments-link'; // Embed the metadata for the "X new comments" link (if any) on this // node.