Skip to content

Commit

Permalink
fixed enum format problem when value is boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Schiavello committed Sep 25, 2019
1 parent 4ba628e commit c832898
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Model/TableSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function getColumnOptions($column) {
if($this->getColumnType($column) == 'bool') {
return [1 => __(''), 0 => __('No')];
}
return isset($this->_columns[$column]['options'])?$this->_columns[$column]['options']:$this->getColumnEnum($column);
return isset($this->_columns[$column]['options'])?$this->_columns[$column]['options']:[];
}

public function getColumnRenderer($column) {
Expand Down Expand Up @@ -320,8 +320,13 @@ public function _formatEnum($value, $column, $row, $options = []) {
}
$enum = $this->_enumFlattenOptions[$column];

if($enum && isset($enum[(string)$value])) {
return $enum[(string)$value];
if($enum) {
if(isset($enum[$value])) {
return $enum[$value];
}
if(isset($enum[(string)$value])) {
return $enum[(string)$value];
}
}
return $value;
}
Expand Down

0 comments on commit c832898

Please sign in to comment.