I’m trying to grab a specific entry from a structure field from another page. I have the value of one of the fields from the structure.
title: About
fields:
entry_title:
label: Title
type: tags
separator: ;
new_entry:
label: Add an entry
type: structure
fields:
title:
label: title
type: select
options: field
field:
name: entry_title
separator: ;
description:
label: Description
type: text
On the homepage, I have the following blueprint to make a select field from the tags on the about page:
title: Home
pages: false
fields:
title:
label: Title
type: text
featured_entry:
label: Featured Entry
type: select
options: field
field:
page: about
name: entry_title
separator: ;
On the homepage, I am trying to use this template to get the entry from the about page that matches the same title as selected in the homepage and echo the rest of the related fields.
<?php
$featured = $page->featured_entry()->value();
$entries = page('about')->new_entry()->toStructure();
?>
<?php foreach($entries as $entry): ?>
<?php $foundEntry = $entry->findBy('title', $featured); ?>
<?= $foundEntry->description() ?>
<?php endforeach ?>
I get the following error: Call to a member function description() on null. All the entries have values however, which should correlate.