From a4103f081ee53cae70370398af1c259291aae875 Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Thu, 1 Mar 2018 10:47:40 -0400 Subject: [PATCH] Fixed compatibility with SilverStripe 3.5 or less --- code/forms/GridFieldSortableRows.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/forms/GridFieldSortableRows.php b/code/forms/GridFieldSortableRows.php index e0e6866..b2b7272 100644 --- a/code/forms/GridFieldSortableRows.php +++ b/code/forms/GridFieldSortableRows.php @@ -189,7 +189,7 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP if (!$many_many) { $sng=singleton($gridField->getModelClass()); $fieldType=$sng->db($this->sortColumn); - if(!$fieldType || !(strtolower($fieldType) == 'dbint' || is_subclass_of($fieldType, 'DBInt'))) { + if(!$fieldType || !(strtolower($fieldType) == 'int' || is_subclass_of($fieldType, 'Int') || strtolower($fieldType) == 'dbint' || is_subclass_of($fieldType, 'DBInt'))) { if(is_array($fieldType)) { user_error('Sort column '.$this->sortColumn.' could not be found in '.$gridField->getModelClass().'\'s ancestry', E_USER_ERROR); }else { @@ -212,8 +212,8 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP list($parentClass, $componentClass, $parentField, $componentField, $table) = $owner->many_many((!empty($this->custom_relation_name) ? $this->custom_relation_name:$gridField->getName())); $extraFields=$owner->many_many_extraFields((!empty($this->custom_relation_name) ? $this->custom_relation_name:$gridField->getName())); - if(!$extraFields || !array_key_exists($this->sortColumn, $extraFields) || !(strtolower($extraFields[$this->sortColumn])=='dbint' || is_subclass_of('DBInt', $extraFields[$this->sortColumn]))) { - user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$extraFields[$this->sortColumn], E_USER_ERROR); + if(!$extraFields || !array_key_exists($this->sortColumn, $extraFields) || !(strtolower($extraFields[$this->sortColumn])=='int' || is_subclass_of('Int', $extraFields[$this->sortColumn])) || strtolower($extraFields[$this->sortColumn])=='dbint' || is_subclass_of('DBInt', $extraFields[$this->sortColumn]))) { + user_error('Sort column '.$this->sortColumn.' must be an instance of DBInt, column is of type '.$extraFields[$this->sortColumn], E_USER_ERROR); exit; } }else {