<?php if ($item = $block->obj()->toObject()) : ?>
    <div class="card subnav-item">
        <div class="btn-type type-<?= $item->btn_type() ?>">
            icon
        </div>
        <div class="card-body">
            <div class="headings">
                <?php if ($item->headline()->isNotEmpty()) : ?>
                    <div class="h2-container">
                        <h2><?= $item->headline() ?></h2>
                    </div>
                <?php endif ?>
                <?php if ($item->subheadline()->isNotEmpty()) : ?>
                    <div class="h3-container">
                        <h3><?= $item->subheadline() ?></h3>
                    </div>
                <?php endif ?>
            </div>

            <!-- button -->
            <?php if ($p = $item->linkedmodal()->toPage()) : ?>
                <?php if (!$p->isDraft()) : ?>
                    <button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#modal__<?= $item->linkedmodal()->toPage()->uid() ?>">
                        <?= $item->btn_label()->or($item->linkedmodal()->toPage()->title()) ?><i class="fas fa-arrow-right"></i>
                    </button>
                <?php else : ?>
                    <button class="btn btn-primary" disabled>Modal inactive</button>
                <?php endif ?>
            <?php else : ?>
                <button class="btn btn-primary" disabled>No modal selected</button>
            <?php endif ?>
        </div>
    </div>

<?php endif ?>