Files
laysense.cn/app/view/footer.php
T

30 lines
1.8 KiB
PHP

<?php
use App\Content\View;
$e = View::escape(...);
$data = $footer['payload'];
$brand = $data['brand'] ?: $site['name'];
$layoutEditor ??= false;
$part = static fn (string $component): string => $layoutEditor ? ' data-layout-component="' . $component . '"' : '';
?>
<footer class="site-footer site-footer-<?= $e($footer['preset']) ?>" id="contact"<?= $showFooter ? '' : ' hidden' ?>>
<div class="wrap site-footer-components">
<?php foreach ($data['components'] as $component): ?>
<?php if ($component === 'brand'): ?>
<a class="wordmark site-brand" href="/" aria-label="<?= $e($brand) ?>,首页"<?= $part('brand') ?>>
<?php if ($layoutEditor): ?><img alt="" hidden><span data-layout-text="brand"></span>
<?php elseif ($data['logo'] !== ''): ?><img src="<?= $e($data['logo']) ?>" alt="<?= $e($brand) ?>" loading="lazy"><?php else: ?><?= $e($brand) ?><?php endif ?>
</a>
<?php elseif ($component === 'text' && ($layoutEditor || $data['text'] !== '')): ?>
<p class="site-footer-text"<?= $part('text') ?><?= $layoutEditor ? ' data-layout-text="text"' : '' ?>><?= $e($data['text']) ?></p>
<?php elseif ($component === 'links' && ($layoutEditor || $data['links'])): ?>
<nav class="site-footer-nav" aria-label="页脚导航"<?= $part('links') ?>>
<?php foreach ($data['links'] as [$url, $label]): ?><a href="<?= $e($url) ?>"><?= $e($label) ?></a><?php endforeach ?>
</nav>
<?php elseif ($component === 'legal' && ($layoutEditor || $data['legal'] !== '')): ?>
<small<?= $part('legal') ?><?= $layoutEditor ? ' data-layout-text="legal"' : '' ?>><?= $e($data['legal']) ?></small>
<?php endif ?>
<?php endforeach ?>
</div>
</footer>