Fixed compatibility with SilverStripe 3.5 or less

This commit is contained in:
UndefinedOffset 2018-03-01 10:47:40 -04:00
parent 37ec6184ce
commit a4103f081e
1 changed files with 3 additions and 3 deletions

View File

@ -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 {