<?php
    $title = get_field('title');
?>

<?php if(have_rows('links')): ?>
    <section class="featured-links">
        <?php if($title): ?>
            <div class='row'>
                <div class='col-xs-12'>
                    <h2 class="featured-links__title section-title section-title--big"><?php echo $title; ?></h2>
                </div>
            </div>
        <?php endif; ?>
        <div class='row'>
            <div class='col-xs-12'>
                <div class="featured-links__items swiper-container">
                    <div class="swiper-wrapper">
                        <?php while(have_rows('links')): ?>
                            <?php
                                the_row();
                                $icon = get_sub_field( 'icon' );
                                $link_title = get_sub_field( 'link_title' );
                                $link_text = get_sub_field( 'link_text' );
                                $link = get_sub_field( 'link' );
                                $wrapperStart = "<div class='featured-links__item swiper-slide'>";
                                $wrapperEnd = "</div>";
                                if ($link) {
                                    $link_target = $link['target'] ? $link['target'] : '_self';
                                    $wrapperStart = "<a href=" . $link['url'] . " target='" . $link_target . "' class='featured-links__item swiper-slide'>";
                                    $wrapperEnd = "</a>";
                                }
                            ?>
                            <?php echo $wrapperStart; ?>

                                <?php if($icon): ?>
                                    <div class="featured-links__item__icon">
                                        <?php echo $__env->make('elements.image', ['image_id' => $icon], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                    </div>
                                <?php endif; ?>
                                <?php if($link_title): ?>
                                    <h3 class="featured-links__item__title section-title section-title--small"><?php echo $link_title; ?></h3>
                                <?php endif; ?>
                                <?php if($link_text): ?>
                                    <div class="featured-links__item__text image-text__paragraph"><?php echo $link_text; ?></div>
                                <?php endif; ?>
                                <?php if($link): ?>
                                    <p class="featured-links__item__link"><?php echo e(__('Learn more', 'aphea')); ?></p>
                                <?php endif; ?>
                            <?php echo $wrapperEnd; ?>

                        <?php endwhile; ?>
                    </div>
                </a>
            </div>
        </div>
    </section>
<?php endif; ?>
<?php /**PATH D:\Projekti\WordPress\aphea\public\app\themes\aphea\resources\views/gutenberg/featured-links.blade.php ENDPATH**/ ?>