Get panel field object from another field within a field

In a field we have access to $this which is a kind of field object that contains for example $this->page().

How do I load the field object from another field on another page?

In need it to use this function in a list of pages:

$fields = $field->page()->blueprint()->fields($this)->toArray();

The list might look like this:

foreach( site()->children() as $page ) {
}

I solved it. I needed to dig deep this time. I don’t know if it’s the best solution but it works fine.

// Above the class
use Kirby\Panel\Models\Page\Blueprint;

// Inside the field input()
$blueprint = new Blueprint('default');
$fields = $blueprint->fields(null)->toArray();

Looks good. :slight_smile:

1 Like