Skip to content

Commit

Permalink
FIX: Modified fix for #2389 to ensure existing tests pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell Michell committed Sep 5, 2013
1 parent 128c33b commit abcb2ef
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions forms/gridfield/GridFieldAddExistingAutocompleter.php
Expand Up @@ -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);
}
Expand Down

0 comments on commit abcb2ef

Please sign in to comment.