diff --git a/app/code/community/BL/CustomGrid/Block/Widget/Grid/Columns/Editor.php b/app/code/community/BL/CustomGrid/Block/Widget/Grid/Columns/Editor.php index 61d5b45..3d3c3ca 100644 --- a/app/code/community/BL/CustomGrid/Block/Widget/Grid/Columns/Editor.php +++ b/app/code/community/BL/CustomGrid/Block/Widget/Grid/Columns/Editor.php @@ -68,7 +68,7 @@ public function getRowsJsonConfig() return Mage::helper('core')->jsonEncode($config); } - protected function _getBlockSortedColumns($block) + protected function _getBlockSortedColumns($block, $sorted = true) { // Get block columns, sort them if needed $columns = $block->getColumns(); diff --git a/app/code/community/BL/CustomGrid/Helper/Data.php b/app/code/community/BL/CustomGrid/Helper/Data.php index fcf9de8..d53851f 100644 --- a/app/code/community/BL/CustomGrid/Helper/Data.php +++ b/app/code/community/BL/CustomGrid/Helper/Data.php @@ -33,20 +33,18 @@ protected function _parseIntValue($value) public function parseCsvIntArray($string, $unique=true, $sorted=false, $min=null, $max=null) { $values = array_map(array($this, '_parseIntValue'), explode(',', $string)); - $filterCodes = array('!is_null($v)'); if ($unique) { $values = array_unique($values); } - if (!is_null($min)) { - $filterCodes[] = '($v >= '.intval($min).')'; - } - if (!is_null($max)) { - $filterCodes[] = '($v <= '.intval($max).')'; - } - - $filterCode = 'return ('.implode(' && ', $filterCodes).');'; - $values = array_filter($values, create_function('$v', $filterCode)); + + $_filterCsvInt = function($v) use ($min, $max) { + return !is_null($v) + && (is_null($min) || $v >= intval($min)) + && (is_null($max) || $v <= intval($max)); + }; + + $values = array_filter($values, $_filterCsvInt); if ($sorted) { sort($values, SORT_NUMERIC); diff --git a/app/code/community/BL/CustomGrid/Model/Grid/Type/Abstract.php b/app/code/community/BL/CustomGrid/Model/Grid/Type/Abstract.php index a72e482..c3946e5 100644 --- a/app/code/community/BL/CustomGrid/Model/Grid/Type/Abstract.php +++ b/app/code/community/BL/CustomGrid/Model/Grid/Type/Abstract.php @@ -327,6 +327,10 @@ protected function _getCustomColumns() 'response' => $response, 'type_model' => $this, )); + + $filterCallback = function($m) { + return ($m instanceof BL_CustomGrid_Model_Custom_Column_Abstract); + }; $this->_customColumns = array_filter( array_merge( @@ -334,7 +338,7 @@ protected function _getCustomColumns() $xmlColumns, $response->getColumns() ), - create_function('$m', 'return ($m instanceof BL_CustomGrid_Model_Custom_Column_Abstract);') + $filterCallback ); uasort($this->_customColumns, array($this, '_sortCustomColumns'));