3237 Posts in 943 Topics by 684 members
|Go to End|
29 December 2011 at 11:52am Last edited: 29 December 2011 11:53am
"Enum('Value1, Value2, Value3')"
But what if I wanted:
"Enum('Value 1, and some Value 2', 'Value 2, and a little bit of Value 7', 'Value3, cake and pie')"
As far as I can tell there's no easy way to do this. I have tried escaping the commas in one string, tried passing it as multiple strings (which of course didn't work), even created this field with , ASCII commas in the hopes that it would write to DB in the raw format, but output in the proper encoding. This was probably the closest attempt at faking this, but the front-end fields are actually just outputting , as raw text.
Feel free to ignore this, it's more of an aesthetics question, I have for now replaced the commas with + that should hopefully carry the same meaning.
19 December 2012 at 4:24am
You could always create a custom field called e.g. "MySweetEnum", containing something like this:
class MySweetEnum extends Enum
public function __construct ( $name )
$enum = array (
'Value 1, and some Value 2',
'Value 2, and a little bit of Value 7',
'Value3, cake and pie'
parent::__construct ( $name, $enum);
and later use it like that:
public static $db = array(
'SomeEnumField' => 'MySweetEnum'
|Go to Top|