mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX: Modified fix for #2389 to ensure existing tests pass.
This commit is contained in:
parent
128c33b82c
commit
abcb2ef40b
@ -232,10 +232,11 @@ class GridFieldAddExistingAutocompleter
|
|||||||
$json = array();
|
$json = array();
|
||||||
foreach($results as $result) {
|
foreach($results as $result) {
|
||||||
// Prevent a circular reference and associated error in CMS/admin
|
// Prevent a circular reference and associated error in CMS/admin
|
||||||
$showInSearch = ($result->ID != $gridField->getForm()->getRecord()->ID);
|
$hideFromSearch = ($gridField->getForm()->getRecord() && ($result->ID == $gridField->getForm()->getRecord()->ID));
|
||||||
if($showInSearch) {
|
if($hideFromSearch) {
|
||||||
$json[$result->ID] = SSViewer::fromString($this->resultsFormat)->process($result);
|
continue;
|
||||||
}
|
}
|
||||||
|
$json[$result->ID] = SSViewer::fromString($this->resultsFormat)->process($result);
|
||||||
}
|
}
|
||||||
return Convert::array2json($json);
|
return Convert::array2json($json);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user