Skip to content

Kirby 6.0.0

$field->toPage()

Returns a page object from a page id in the field

$field->toPage(): Page|null

Return types

Kirby\Cms\Pageornull

Examples

<?php if ($related = $page->related()->toPage()): ?>
  <p><a href="<?= $related->url() ?>">Read more…</a></p>
<?php endif ?>