Checkboxes query

So I am trying to create a link selecter for the footer menu.

Blueprint

footerlinks:
    label:
        en:    Footer Links
        de:    Footer Links
    type:      checkboxes
    default:   architecture
    options:   query
    query:
        fetch: index

Code

<?php foreach($site->footerlinks()->split() as $footerlinks): ?>
    <li>
	    <a href="<?= $footerlinks->url() ?>">
		    <?= $footerlinks->navigationname()->html() ?>
	    </a>
	</li>
<?php endforeach ?>

How would I achieve this because using <?php echo html($category) ?> will just return the value, so how do I go about retrieving the URL etc…? Is there where I need to use a hook?

First, I’d modify the blueprint a bit, so that the Panel saves the URI instead of just the UID:

  footerlinks:
    label:
        en:    Footer Links
        de:    Footer Links
    type:      checkboxes
    default:   architecture
    options:   query
    query:
        fetch: index
        value: '{{uri}}'

Then, in your template:

<?php
foreach($site->footerlinks()->split() as $footerlink): ?>
  <?php if($p = page($footerlink)): ?>
    <li>
	    <a href="<?= $p->url() ?>">
		    <?= $p->navigationname()->html() ?>
	    </a>
	</li>
<?php endif ?>
<?php endforeach; ?>
1 Like

Many thanks yet again :slight_smile: