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 Answer 1

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.

2
  • Any info when it'll be available ?
    – maxx
    Aug 29, 2014 at 17:44
  • Very soon now...
    – Brad Bell
    Aug 29, 2014 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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