<?php

use Tangibledesign\MyHome\Widgets\General\FaqWidget;

/* @var FaqWidget $mhCurrentWidget */
global $mhCurrentWidget;

$faqItems = $mhCurrentWidget->getFaqItems();

if ($faqItems->isEmpty()) {
    return;
}
?>

<div class="myhome-faq-widget__grid">
    <?php foreach ($faqItems as $item) : ?>
        <div class="myhome-faq-widget__item">
            <?php if (!empty($item['question'])) : ?>
                <h3 class="myhome-faq-widget__question">
                    <?php echo esc_html($item['question']); ?>
                </h3>
            <?php endif; ?>

            <?php if (!empty($item['answer'])) : ?>
                <div class="myhome-faq-widget__answer">
                    <?php echo esc_html($item['answer']); ?>
                </div>
            <?php endif; ?>
        </div>
    <?php endforeach; ?>
</div>