comparison core/modules/comment/src/CommentLinkBuilder.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children 12f9dff5fda9
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
105 if (!empty($entity->get($field_name)->comment_count)) { 105 if (!empty($entity->get($field_name)->comment_count)) {
106 $links['comment-comments'] = [ 106 $links['comment-comments'] = [
107 'title' => $this->formatPlural($entity->get($field_name)->comment_count, '1 comment', '@count comments'), 107 'title' => $this->formatPlural($entity->get($field_name)->comment_count, '1 comment', '@count comments'),
108 'attributes' => ['title' => $this->t('Jump to the first comment.')], 108 'attributes' => ['title' => $this->t('Jump to the first comment.')],
109 'fragment' => 'comments', 109 'fragment' => 'comments',
110 'url' => $entity->urlInfo(), 110 'url' => $entity->toUrl(),
111 ]; 111 ];
112 if ($this->moduleHandler->moduleExists('history')) { 112 if ($this->moduleHandler->moduleExists('history')) {
113 $links['comment-new-comments'] = [ 113 $links['comment-new-comments'] = [
114 'title' => '', 114 'title' => '',
115 'url' => Url::fromRoute('<current>'), 115 'url' => Url::fromRoute('<current>'),
139 'entity' => $entity->id(), 139 'entity' => $entity->id(),
140 'field_name' => $field_name, 140 'field_name' => $field_name,
141 ]); 141 ]);
142 } 142 }
143 else { 143 else {
144 $links['comment-add'] += ['url' => $entity->urlInfo()]; 144 $links['comment-add'] += ['url' => $entity->toUrl()];
145 } 145 }
146 } 146 }
147 elseif ($this->currentUser->isAnonymous()) { 147 elseif ($this->currentUser->isAnonymous()) {
148 $links['comment-forbidden'] = [ 148 $links['comment-forbidden'] = [
149 'title' => $this->commentManager->forbiddenMessage($entity, $field_name), 149 'title' => $this->commentManager->forbiddenMessage($entity, $field_name),
172 'entity' => $entity->id(), 172 'entity' => $entity->id(),
173 'field_name' => $field_name, 173 'field_name' => $field_name,
174 ]); 174 ]);
175 } 175 }
176 else { 176 else {
177 $links['comment-add']['url'] = $entity->urlInfo(); 177 $links['comment-add']['url'] = $entity->toUrl();
178 } 178 }
179 } 179 }
180 } 180 }
181 elseif ($this->currentUser->isAnonymous()) { 181 elseif ($this->currentUser->isAnonymous()) {
182 $links['comment-forbidden'] = [ 182 $links['comment-forbidden'] = [