Check that method 'hasMethod' exists in GridFieldSortableHeader

This commit is contained in:
Loz Calver 2015-08-03 16:49:18 +01:00
parent 4485b266e2
commit 1b6442058d

View File

@ -111,7 +111,7 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM
if($tmpItem instanceof SS_List) {
// It's impossible to sort on a HasManyList/ManyManyList
break;
} elseif($tmpItem->hasMethod($methodName)) {
} elseif(method_exists($tmpItem, 'hasMethod') && $tmpItem->hasMethod($methodName)) {
// The part is a relation name, so get the object/list from it
$tmpItem = $tmpItem->$methodName();
} elseif($tmpItem instanceof DataObject && $tmpItem->hasField($methodName)) {