GridFieldAddExistingAutocompleter
class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridField_ActionProvider, GridField_DataManipulator, GridField_URLHandler
This class is is responsible for adding objects to another object's has_many and many_many relation, as defined by the {@link RelationList} passed to the {@link GridField} constructor.
Objects can be searched through an input field (partially matching one or more fields).
Selecting from the results will add the object to the relation.
Often used alongside {@link GridFieldDeleteAction} for detaching existing records from a relationship.
For easier setup, have a look at a sample configuration in {@link GridFieldConfig_RelationEditor}.
Methods
No description
No description
Manipulate the state to add a new relation
If an object ID is set, add the object to the list
No description
Returns a json array of a search results that can be used by for example Jquery.ui.autosuggestion
No description
No description
Sets the base list instance which will be used for the autocomplete search.
No description
No description
Detect searchable fields and searchable relations.
No description
No description
Gets the maximum number of autocomplete results to display.
No description
Details
at line 85
__construct(string $targetFragment = 'before', array $searchFields = null)
at line 95
array
getHTMLFragments($gridField)
at line 139
Array
getActions(GridField $gridField)
at line 151
handleAction(GridField $gridField, String $actionName, Array $arguments, Array $data)
Manipulate the state to add a new relation
at line 168
DataList
getManipulatedData(GridField $gridField, SS_List $dataList)
If an object ID is set, add the object to the list
at line 186
getURLHandlers($gridField)
at line 198
doSearch(GridField $gridField, SS_HTTPRequest $request)
Returns a json array of a search results that can be used by for example Jquery.ui.autosuggestion
at line 238
$this
setResultsFormat(string $format)
at line 246
string
getResultsFormat()
at line 256
setSearchList(SS_List $list)
Sets the base list instance which will be used for the autocomplete search.
at line 264
setSearchFields(array $fields)
at line 272
array
getSearchFields()
at line 284
array|null
scaffoldSearchFields(string $dataClass)
Detect searchable fields and searchable relations.
Falls back to {@link DataObject->summaryFields()} if no custom search fields are defined.
at line 322
string
getPlaceholderText(string $dataClass)
at line 356
$this
setPlaceholderText(string $text)
at line 366
int
getResultsLimit()
Gets the maximum number of autocomplete results to display.