Révision b4adf10d
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/modules/comment/comment.module | ||
---|---|---|
993 | 993 |
$comment->content = array(); |
994 | 994 |
|
995 | 995 |
// Allow modules to change the view mode. |
996 |
$context = array( |
|
997 |
'entity_type' => 'comment', |
|
998 |
'entity' => $comment, |
|
999 |
'langcode' => $langcode, |
|
1000 |
); |
|
1001 |
drupal_alter('entity_view_mode', $view_mode, $context); |
|
996 |
$view_mode = key(entity_view_mode_prepare('comment', array($comment->cid => $comment), $view_mode, $langcode)); |
|
1002 | 997 |
|
1003 | 998 |
// Build fields content. |
1004 | 999 |
field_attach_prepare_view('comment', array($comment->cid => $comment), $view_mode, $langcode); |
... | ... | |
1108 | 1103 |
* An array in the format expected by drupal_render(). |
1109 | 1104 |
*/ |
1110 | 1105 |
function comment_view_multiple($comments, $node, $view_mode = 'full', $weight = 0, $langcode = NULL) { |
1111 |
field_attach_prepare_view('comment', $comments, $view_mode, $langcode); |
|
1112 |
entity_prepare_view('comment', $comments, $langcode); |
|
1106 |
$build = array(); |
|
1107 |
$entities_by_view_mode = entity_view_mode_prepare('comment', $comments, $view_mode, $langcode); |
|
1108 |
foreach ($entities_by_view_mode as $entity_view_mode => $entities) { |
|
1109 |
field_attach_prepare_view('comment', $entities, $entity_view_mode, $langcode); |
|
1110 |
entity_prepare_view('comment', $entities, $langcode); |
|
1111 |
|
|
1112 |
foreach ($entities as $entity) { |
|
1113 |
$build[$entity->cid] = comment_view($entity, $node, $entity_view_mode, $langcode); |
|
1114 |
} |
|
1115 |
} |
|
1113 | 1116 |
|
1114 |
$build = array( |
|
1115 |
'#sorted' => TRUE, |
|
1116 |
); |
|
1117 | 1117 |
foreach ($comments as $comment) { |
1118 |
$build[$comment->cid] = comment_view($comment, $node, $view_mode, $langcode); |
|
1119 | 1118 |
$build[$comment->cid]['#weight'] = $weight; |
1120 | 1119 |
$weight++; |
1121 | 1120 |
} |
1121 |
// Sort here, to preserve the input order of the entities that were passed to |
|
1122 |
// this function. |
|
1123 |
uasort($build, 'element_sort'); |
|
1124 |
$build['#sorted'] = TRUE; |
|
1125 |
|
|
1122 | 1126 |
return $build; |
1123 | 1127 |
} |
1124 | 1128 |
|
Formats disponibles : Unified diff
Udpate to 7.33