61 lines
3.2 KiB
PHP
61 lines
3.2 KiB
PHP
<?php
|
||
$services_title = get_field('services_title');
|
||
$services_description = get_field('services_description');
|
||
$services_title_links = get_field('services_title_links');
|
||
$services_links = get_field('services_links') ?: [];
|
||
$services_repeat = get_field('services_repeat') ?: [];
|
||
if (!$services_title && !$services_repeat) {
|
||
return;
|
||
}
|
||
?>
|
||
<section class="courier-services"<?php if ($services_title) : ?> aria-labelledby="courier-services-title"<?php endif; ?>>
|
||
<?php if ($services_title || $services_description) : ?>
|
||
<header class="courier-services__header">
|
||
<?php if ($services_title) : ?>
|
||
<h2 class="courier-services__title" id="courier-services-title"><?php echo esc_html($services_title); ?></h2>
|
||
<?php endif; ?>
|
||
<?php if ($services_description) : ?>
|
||
<p class="courier-services__description"><?php echo nl2br(esc_html($services_description)); ?></p>
|
||
<?php endif; ?>
|
||
</header>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($services_links || $services_repeat) : ?>
|
||
<div class="courier-services__content">
|
||
<?php if ($services_links) : ?>
|
||
<nav class="courier-services__navigation" aria-label="О работе курьером">
|
||
<?php if ($services_title_links) : ?>
|
||
<p class="courier-services__navigation-title"><?php echo esc_html($services_title_links); ?></p>
|
||
<?php endif; ?>
|
||
<div class="courier-services__topics">
|
||
<?php foreach ($services_links as $item) : ?>
|
||
<?php if (empty($item['name']) || empty($item['url'])) continue; ?>
|
||
<a class="courier-services__topic" href="<?php echo esc_url($item['url']); ?>"><?php echo esc_html($item['name']); ?></a>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</nav>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($services_repeat) : ?>
|
||
<ul class="courier-services__grid" aria-label="Сервисы доставки">
|
||
<?php foreach ($services_repeat as $item) : ?>
|
||
<?php
|
||
if (empty($item['name']) || empty($item['link'])) continue;
|
||
$logo = $item['img'] ?? [];
|
||
?>
|
||
<li>
|
||
<a class="courier-services__card" target="_blank" href="<?php echo esc_url($item['link']); ?>" aria-label="<?php echo esc_attr(sprintf('Подключиться к сервису «%s» через Hantico', $item['name'])); ?>">
|
||
<?php if (!empty($logo['url'])) : ?>
|
||
<span class="courier-services__logo"><img src="<?php echo esc_url($logo['url']); ?>" alt="" loading="lazy" decoding="async"></span>
|
||
<?php endif; ?>
|
||
<span class="courier-services__name"><?php echo esc_html($item['name']); ?></span>
|
||
<span class="courier-services__arrow" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 13 13" fill="none" focusable="false"><path d="M12.5537 7.72367L10.6267 7.71891L10.6369 3.27442L1.36107 12.5326L0.00014086 11.1689L9.25079 1.93597L4.8608 1.92575L4.86557 0.000152722L12.5721 0.0178628L12.5537 7.72367Z" fill="currentColor"/></svg></span>
|
||
</a>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
</ul>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
</section>
|