Revision #4 has been created by nsanden on Nov 30, 2013, 8:31:19 PM with the memo:
Changed the explode so enum values like this work fine. 'Shaved & Tapered','Unshaved, no Rest','Unshaved, with Rest','Shaved, no Rest'
« previous (#3) next (#5) »
Changes
Title
unchanged
Drop down list with enum values for column of type ENUM >+> incorporate into giix
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
drop down list, input, forms, views, enum, giix, activeDropDownList
Content
changed
[...]
public static function enumItem($model,$attribute) {
$attr=$attribute;
self::resolveName($model,$attr);
preg_match('/\((.*)\)/',$model->tableSchema->columns[$attr]->dbType,$matches);
foreach(explode(',\',\'', $matches[1]) as $value) {
$value=str_replace("'",null,$value);
$values[$value]=Yii::t('enumItem',$value);
}
return $values;
}[...]