Initial commit
This commit is contained in:
18
kirby-baukasten-main/site/snippets/link.php
Normal file
18
kirby-baukasten-main/site/snippets/link.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var Kirby\Cms\StructureObject|Kirby\Content\Content $link
|
||||
*/ ?>
|
||||
|
||||
<?php if ($link->link()->isNotEmpty()) : ?>
|
||||
<a <?= attr([
|
||||
'class' => $class ?? '',
|
||||
'href' => $link->link()->toUrl(),
|
||||
'target' => $link->newTab()->toBool() ? '_blank' : null,
|
||||
'rel' => $link->newTab()->toBool() ? 'noopener' : null,
|
||||
'aria-current' => $link->link()->linkType() === 'page' && $link->link()->toPage()?->isActive() ? 'page' : null,
|
||||
...($attr ?? [])
|
||||
]) ?>>
|
||||
<?= $slot ?? $link->label()->or($link->link()->linkTitle()) ?>
|
||||
</a>
|
||||
<?php endif ?>
|
||||
Reference in New Issue
Block a user