Skip to content

Kirby 4.5.0

$field->toPage()

Returns a page object from a page id in the field

$field->toPage(): Kirby\Cms\Page|null

Return type

Kirby\Cms\Page|null

Example

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