I want to have setting to show/hide 3 fields independent of each other.
This rule shows “title” field only if one checkbox “title” is checked. But if any other checkbox is checked, then “title” is hidden. <?php if ($page->settings_fields()->value() == "title"): ?>
How to make it work with any combination? For example, both “title” and “photo” options selected - then “title” should be shown.
<?php
if (in_array($page->settings_fields()->value(), ['a', 'b', 'c'])) {
// this stuff will be done if the settings_fields field has either value a, b, or c;
}
Not quite sure what fields you have there? Looks like you have multiple fields, so the above won’t work.
Actually I can just do 3 separate field for this, but in this case it’s to make it look more compact, as if I put fields in column with 1/3 width, it’s impossible to make width of inner fields 1/3, they take all space
If “title” is checked, then I want to print “title” fields. If “cover” is checked, then “cover” fields should be printed. If both “title” and “cover” check, then both should be printed etc. So what is checked, should be printed.
By the way, is it possible to set, that at least one value should be checked? As in this case it won’t make sense to uncheck all, as at least one field should be printed?