Created
November 18, 2021 08:40
-
-
Save mauricerenck/12d2edb6cc58c991ac7986f7ace8d25d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace mauricerenck\Komments; | |
$kommentUtils = new KommentBaseUtils(); | |
$komments = $kommentUtils->parseKomments($page->kommentsInbox()); | |
$kommentList = ['LIKES' => [], 'REPOSTS' => [], 'REPLIES' => [], 'MENTIONS' => []]; | |
$kommentsInModeration = 0; | |
function addReply($komment) | |
{ | |
snippet('komments/type/reply', ['komment' => $komment]); | |
if (count($komment['replies']) > 0) { | |
echo '<ul>'; | |
foreach ($komment['replies'] as $reply) { | |
addReply($reply); | |
} | |
echo '</ul>'; | |
} | |
} | |
if (count($komments['replies']) > 0) { | |
foreach ($komments['replies'] as $komment) { | |
if ($page->hasQueuedKomments($komment['komment']->id(), $komment['komment']->status())) { | |
$kommentsInModeration++; | |
} | |
} | |
} | |
?> | |
<div id="kommentsWebmentions"> | |
<?php if ($kommentsInModeration > 0): ?> | |
<div class="uk-alert-primary uk-border-rounded" id="inModeration" uk-alert><?php echo t('mauricerenck.komments.moderation'); ?></div> | |
<?php endif; ?> | |
<div class="uk-grid-large" uk-grid> | |
<div class="uk-width-2-3@m"> | |
<?php if ($page->kommentsAreEnabled()): ?> | |
<?php snippet('komments/kommentform'); ?> | |
<hr class="uk-divider-icon"> | |
<?php endif; ?> | |
<?php if (count($komments['replies']) > 0) : ?> | |
<h4><?php echo t('mauricerenck.komments.headline.replies'); ?></h4> | |
<?php foreach ($komments['replies'] as $komment) : addReply($komment); endforeach; ?> | |
<?php endif; ?> | |
</div> | |
</div> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment