I’m using multiselect in a blueprint to assign different categories to projects in my portfolio.
category:
type: multiselect
options:
photography: Photography
graphicDesign: Graphic Design
userInterface: User Interface
typeDesign: Type Design
In a Template I am using these values at different positions. How is it possible (using “Graphic Design” as an example) to sometimes insert “graphicDesign” and sometimes “Graphic Design”?
<?php
// get the available options from the blueprint
$options = $page->blueprint()->field('category')['options'];
dump($options);
// when looping through the stored values, fetch the option with the key from the options array
foreach($page->category()->split(',') as $category) {
echo $options[$category] ?? $category;
}