Display content when certain option is selecred

Since your field depend on the values of other fields, you also need the same conditions on the frontend.

For example, you only show a field X when the field value of Type is Y.

In frontend:

<?php
if ($page->y()->value() === 'whatever' && $page->x()->isNotEmpty()) {
  echo $page->x();
}

You can either store the names as values, or create a category map (example is Kirby 2 but you get the idea), or use translation variables in a multi-language site or access the name via $page->blueprint() (note that this is not necessarily ideal, because you need to access the blueprint).

2 Likes