Get a list of all and for each page children Radio Buttons

What would be the way to get a list of all items in a radio button selection of 5 items and also in a foreach loop the one chosen for each sub page?

The structure is similar to:

- Project A - Radio button Option 1
- Project B - Radio button Option 2
- Project C - Radio button Option 3

So on the Projects page to end up with a list of all radio buttons (option 1,2,3,4,5) and for each post to get the selected one.

I’m trying to make a sortable posts with Isotope

Well, loop through your projects and then create an input of type radio or a button for each project with the markup required by isotope (probably a data attribute). The rest should then be handled by isotope.

I think I was doing something wrong, it’s working properly now.

Except when I use <?php echo $category->category() ?> in the foreach loop, I get as result the name of the field, not it’s label for example: optionOne when I should get Option One from the blue print:

    label: Category
    type: radio
      optionOne: Option One

“Option One” is just shown to the user in the Panel, while “optionOne” is what is saved in the content file. If you want to print “Option One” in the browser, you best create a “category map” in your config.php.

c::set('categories', [
  'optionOne' => 'Option One',
  'optionTwo' => 'Option Two',
  // etc.

You can then grab it in your template like this:

<?= c::get('categories')[$category->category()] ?>

If you have a multi-lang site, you can use language variables for this purpose.

That would be the same as to write the list in the template.php. Was hoping there could be an automated way.

Would the same apply to checkboxes?

Oh, if you don’t want that, you might as well write your options like this:

    label: Category
    type: radio
      "Option One": Option One
      "Option Two": Option Two