Get the blueprint in the a panel field, from another page?

Probably a difficult question, but I think it’s great to have an answer to it here now and for the future.

1. Blueprint from another page

In a panel field I have the need to get a blueprint array or object from another field. How is that done? Not a reference to the file but an object or array.

2. Panel object outside the panel

When in a route (not a panel field route) I would like to do that as well. Can I load the required panel objects needed somehow? I don’t mind if it takes 1 second extra to load.

I must admin that I don’t really understand your question. But maybe the Kirby Architect might help you, as it provides blueprint data across your installation.

Easily reference Blueprint data from anywhere in your Kirby application.

And didn’t you create some sort of blueprint plugin yourself a while ago?

Yes I did but I did not want to “reinvent the wheel”. I know that the panel does it and I’m inside the panel. There are blueprint data in the panel page object, but the problem is that I want to get it from another page.

Else both Architect and Blueprint plugin can do this.

However, in this case I only need the blueprint keys so I don’t need to do much this time.

https://getkirby.com/docs/toolkit/api/yaml/read

Update

I can’t use the above because I might register a blueprint with register set and then the file will not be found.

Update 2

I solved that problem as well. In a field function:

global $kirby;
print_r( $kirby->get('blueprint') );

Then a key/value list appears with all blueprints registered. :slight_smile:

Instead of using global variables, you can just use:

print_r( kirby()->get('blueprint') );
1 Like