<?php
/* @var \Tangibledesign\MyHome\Widgets\General\BlogCategoriesWidget $mhCurrentWidget */
global $mhCurrentWidget;

$mhCategories = $mhCurrentWidget->getCategories();
if ($mhCategories->isEmpty()) {
    return;
}
?>
<div class="myhome-sidebar-widget">
    <h3 class="myhome-sidebar-widget__label">
        <?php echo esc_html($mhCurrentWidget->getLabel()); ?>
    </h3>

    <div class="myhome-sidebar-widget__content">
        <div class="myhome-sidebar-list">
            <?php foreach ($mhCategories as $mhCategory) : ?>
                <a
                        class="myhome-sidebar-list__item"
                        href="<?php echo esc_url($mhCategory->getUrl()); ?>"
                >
                    <span class="myhome-sidebar-list__label">
                        <?php echo esc_html($mhCategory->getName()); ?>
                    </span>

                    <span class="myhome-sidebar-list__count">
                        (<?php echo esc_html($mhCategory->getCount()); ?>)
                    </span>
                </a>
            <?php endforeach; ?>
        </div>
    </div>
</div>