Output checkbox value?


#1

What is the best way to access the options value-input from the blueprint?
with <?= $page-> languages() ?> I’m only able to output the first part (latin1, latin2, latin3) when I’m looking to get (Western, Centeral Europe, Scandinavian)

  languages:
    label: Languages
    type: checkboxes
    options:
      latin1: "Western"
      latin2: "Central Europe"
      latin3: "Scandinavian"

#2

You can use a category map as described several times here on the forum, e.g. Saving Categories, How to return the category value on the frontend?

If you have a multi-language site, you can use language variables instead. The alternative would be to store the desired values instead of latin1etc.


#3

Thank you, really helpful reading.

Is there anyway to output the options that have not been selected?

Eg.

<?= $page-> languages()->isEmpty() ?>

#4

If you create an array of all options, you can get the difference between what has been selected and that array using PHP’s array functions.