1

So I have a model with an Enum and I want a selectField for that Enum. Is there a DRY way to do that ? And if yes does it work with the translation-filter ?

1

The upcoming Craft 2.2 release added a getConstants() method to the BaseEnum class so you'd be able to do:

EnumClass::getConstants()

to get an array of all of the options in an enum.

| improve this answer | |
  • Any info when it'll be available ? – maxx Aug 29 '14 at 17:44
  • Very soon now... – Brad Bell Aug 29 '14 at 18:17

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.