I am testing the type field. The use can for example select a page or a link (or other types, see Link field | Kirby CMS).
If page
is selected I can get the URL of the page with this code
<?= $block->link()->toPage()->permalink() ?>
Of course, this doesn’t work if the “link” is a URL. So I need a switch-statement for all 5 possible link-types). Is there a better solution I am not seeing?
Just for reference, my block:
name: Infofeld
icon: info
label: "{{ name }} - {{ kurzbeschreibung }}"
fields:
name:
type: text
kurzbeschreibung:
type: textarea
link:
label: Verweis
type: link