2

I have a multi-select field in my work section

enter image description here

I want to get the values either with the Element api as json or an array of simple values in my template.

  • Do you want every possible value for the field? Or all of the selected values for the field on an element (i.e. entry, user, etc.). – Brad Bell Jul 31 '18 at 23:28
  • Hi Brad, every value. – LeBlaireau Aug 1 '18 at 4:35
1

$element->getFieldValue('handle') or it's Twig equivalent element.handle contains an Object of type MultiOptionsFieldData you can get all possible values via itsgetOptions()` function

Twig

{{ dump(entry.fieldHandle.getOptions()) }}

PHP

$options = $element->getFieldValue('handle')->getOptions();
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.