Skip to content

Commit

Permalink
Merge pull request silverstripe#4473 from kinglozzer/gf-sortableheade…
Browse files Browse the repository at this point in the history
…r-method-exists

Check that method 'hasMethod' exists in GridFieldSortableHeader
  • Loading branch information
dhensby committed Aug 3, 2015
2 parents 4485b26 + 1b64420 commit d0d34bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion forms/gridfield/GridFieldSortableHeader.php
Expand Up @@ -111,7 +111,7 @@ public function getHTMLFragments($gridField) {
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)) {
Expand Down

0 comments on commit d0d34bd

Please sign in to comment.