Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Commit

Permalink
fix(attachments): fix attachments formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hypeJunction committed May 7, 2018
1 parent 4c64680 commit 59a9a34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions classes/hypeJunction/Wall/Post.php
Expand Up @@ -70,6 +70,8 @@ public function formatAttachments() {
'entity' => $this,
]);

$attachments = array_filter($attachments);

$output = (count($attachments)) ? implode('', $attachments) : false;
return elgg_trigger_plugin_hook('attachments:format', 'wall', ['entity' => $this], $output);
}
Expand Down
8 changes: 6 additions & 2 deletions views/default/output/wall/attachments.php
Expand Up @@ -30,7 +30,7 @@
elgg_push_context('wall-attachments');

if (empty($non_images)) {
echo elgg_view_entity_list($images, [
$output = elgg_view_entity_list($images, [
'full_view' => false,
'pagination' => false,
'list_type' => 'gallery',
Expand All @@ -39,14 +39,18 @@
'rel' => "wall-popup-{$entity->guid}",
]);
} else {
echo elgg_view_entity_list(array_merge($images, $non_images), [
$output = elgg_view_entity_list(array_merge($images, $non_images), [
'full_view' => false,
'pagination' => false,
'list_class' => 'wall-attachments-list',
]);
}

elgg_pop_context();

if (!$output) {
return;
}
?>
<script>
require(['output/wall/attachments'], function (lib) {
Expand Down

0 comments on commit 59a9a34

Please sign in to comment.