Mercurial > hg > isophonics-drupal-site
comparison core/modules/comment/src/CommentViewBuilder.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
96 | 96 |
97 parent::buildComponents($build, $entities, $displays, $view_mode); | 97 parent::buildComponents($build, $entities, $displays, $view_mode); |
98 | 98 |
99 // A counter to track the indentation level. | 99 // A counter to track the indentation level. |
100 $current_indent = 0; | 100 $current_indent = 0; |
101 $attach_history = $this->moduleHandler->moduleExists('history') && $this->currentUser->isAuthenticated(); | |
101 | 102 |
102 foreach ($entities as $id => $entity) { | 103 foreach ($entities as $id => $entity) { |
103 if ($build[$id]['#comment_threaded']) { | 104 if ($build[$id]['#comment_threaded']) { |
104 $comment_indent = count(explode('.', $entity->getThread())) - 1; | 105 $comment_indent = count(explode('.', $entity->getThread())) - 1; |
105 if ($comment_indent > $current_indent) { | 106 if ($comment_indent > $current_indent) { |
141 | 142 |
142 if (!isset($build[$id]['#attached'])) { | 143 if (!isset($build[$id]['#attached'])) { |
143 $build[$id]['#attached'] = []; | 144 $build[$id]['#attached'] = []; |
144 } | 145 } |
145 $build[$id]['#attached']['library'][] = 'comment/drupal.comment-by-viewer'; | 146 $build[$id]['#attached']['library'][] = 'comment/drupal.comment-by-viewer'; |
146 if ($this->moduleHandler->moduleExists('history') && $this->currentUser->isAuthenticated()) { | 147 if ($attach_history && $commented_entity->getEntityTypeId() === 'node') { |
147 $build[$id]['#attached']['library'][] = 'comment/drupal.comment-new-indicator'; | 148 $build[$id]['#attached']['library'][] = 'comment/drupal.comment-new-indicator'; |
148 | 149 |
149 // Embed the metadata for the comment "new" indicators on this node. | 150 // Embed the metadata for the comment "new" indicators on this node. |
150 $build[$id]['history'] = [ | 151 $build[$id]['history'] = [ |
151 '#lazy_builder' => ['history_attach_timestamp', [$commented_entity->id()]], | 152 '#lazy_builder' => ['history_attach_timestamp', [$commented_entity->id()]], |