Using multiselect fields in templates

Hello,

As far as I can tell, I am using the multiselect field the way this reference page outlines.

However, I am unable to render the options’ text in my page. For instance, my template contains <?= $page->services() ?> and on the page this renders the selected option as conceptDevelopment when I would like it to say Concept Development. Is there a field method that I’m overlooking or maybe an issue with my blueprint?

services:
  label: Services
  type: multiselect
  min: 2
  max: 4
  options:
    architecture: Architecture
    design: Design
    programming: Programming
    strategy: Strategy
    conceptDevelopment: Concept Development
    research: Research
    publishing: Publishing

Thank you for your time

Kirby renders what is stored in the text file, which is the value (e.g. architecture), not the text that is shown in the Panel to the user.

You have multiple options here:

  • Store the text that is shown to the user instead of the value, by making both the same

  • Create a mapping array in your config from which you can then pull the value via the key.

    'services' => [
      'architecture' => 'Architecture',
      // etc.
    ]
    
  • In a multilanguage site, you can use language variables for this purpose

  • Access the blueprint in the frontend to get the text: Using blueprints in the frontend | Kirby CMS

Thank you so much for your quick suggestion! I will try these options :slight_smile: