protected $_multiple = false;
protected $_allowNull = true;
protected $_options = [];
+ protected $_options_aliases = [];
public function getDefaultAttributes()
{
- return array_merge(parent::getDefaultAttributes(), ['options' => $this->_options, 'allows_null' => $this->_allowNull, 'allows_multiple' => $this->_multiple]);
+ return array_merge(parent::getDefaultAttributes(), ['options' => $this->_options, 'options_aliases' => $this->_options_aliases, 'allows_null' => $this->_allowNull, 'allows_multiple' => $this->_multiple]);
}
+
public function getColumnData()
{
$res = parent::getColumnData();
$res['options'] = $this->getAttribute('options');
return $res;
}
+
+ public function filterValue($value)
+ {
+ $value = parent::filterValue($value);
+ $aliases = $this->getAttribute('options_aliases', []);
+ if (isset($aliases[$value])) {
+ $value = $aliases[$value];
+ }
+ return $value;
+ }
}