Panel: querying "site.txt" structure fields as pages/subpages fields' values

Thank you for the ideas… I believe this could be the definitive solution… a plugin (or custom field) that allows a field (select, radio and checkboxes) to query structure fields, be it from site.txt or any other page/subpage.

I thought about using this new json thingy… but then got stuck about where to save it… I don’t want to create a page just to have a place for saving the .json file.

I thought the perfect place would be the assets folder… like
/assets/json/event.json but again have no idea how to access/read it neither how to write it in order to accomplish what i’ve posted above.

For now my options are hardcoded in the “event” blueprint, using a simple select field… and I’m using a controller to translate the values into names… so it’s static and every time the panel user needs a new value I’d have to update the website.

the controller :

<?php
  return function($site, $pages, $page) {
    return array( 'event_type' => array( 
                             0 => 'Meetup', 
                             1 => 'Workshop', 
                             2 => 'Lecture')
    );
  };
?>
 

And in the template I fetch it like:

<p>Event type: <?php echo $event_type[$page->event_type()->int()] ?></p> 

So much to learn… :confused: