I have a multi-select field in my work section
I want to get the values either with the Element api as json or an array of simple values in my template.
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.
Sign up to join this communityI have a multi-select field in my work section
I want to get the values either with the Element api as json or an array of simple values in my template.
$element->getFieldValue('handle')
or it's Twig equivalent element.handle
contains an Object of type MultiOptionsFieldData
you can get all possible values via its
getOptions()` function
{{ dump(entry.fieldHandle.getOptions()) }}
$options = $element->getFieldValue('handle')->getOptions();