Permalink
Browse files

FIX: Modified fix for #2389 to ensure existing tests pass.

  • Loading branch information...
1 parent 128c33b commit abcb2ef40b9da358b5f0662b499134ab5f8f9527 Russell Michell committed Sep 5, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 forms/gridfield/GridFieldAddExistingAutocompleter.php
@@ -232,10 +232,11 @@ public function doSearch($gridField, $request) {
$json = array();
foreach($results as $result) {
// Prevent a circular reference and associated error in CMS/admin
- $showInSearch = ($result->ID != $gridField->getForm()->getRecord()->ID);
- if($showInSearch) {
- $json[$result->ID] = SSViewer::fromString($this->resultsFormat)->process($result);
+ $hideFromSearch = ($gridField->getForm()->getRecord() && ($result->ID == $gridField->getForm()->getRecord()->ID));
+ if($hideFromSearch) {
+ continue;
}
+ $json[$result->ID] = SSViewer::fromString($this->resultsFormat)->process($result);
}
return Convert::array2json($json);
}

0 comments on commit abcb2ef

Please sign in to comment.