Display content when certain option is selecred

Hi there,

So I have some issues not knowing how to implement this in the front-end part.
I have a project page structure with certain fields that are different based on the project type you’ve selected and they are shown or hidden based on the project type you’ve selected. I’ve managed to make this work on the panel side with the “when” option in the blueprint.

My problem now is that I can’t figure it out how to fetch it in the front-end so it displays only the content from the fields that are related with the project type selected.

Also, how can I display the name of the category I’ve selected?

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:

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).