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
Manipulate the state to add a new relation
If an object ID is set, add the object to the list
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 93
__construct(string $targetFragment = 'before', array $searchFields = null)
at line 104
array
getHTMLFragments(GridField $gridField)
at line 160
array
getActions(GridField $gridField)
at line 173
handleAction(GridField $gridField, string $actionName, array $arguments, array $data)
Manipulate the state to add a new relation
at line 191
SS_List
getManipulatedData(GridField $gridField, SS_List $dataList)
If an object ID is set, add the object to the list
at line 210
array
getURLHandlers(GridField $gridField)
at line 224
string
doSearch(GridField $gridField, HTTPRequest $request)
Returns a json array of a search results that can be used by for example Jquery.ui.autosuggestion
at line 275
$this
setResultsFormat(string $format)
at line 284
string
getResultsFormat()
at line 295
setSearchList(SS_List $list)
Sets the base list instance which will be used for the autocomplete search.
at line 305
$this
setSearchFields(array $fields)
at line 314
array
getSearchFields()
at line 327
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 366
string
getPlaceholderText(string $dataClass)
at line 406
$this
setPlaceholderText(string $text)
at line 417
int
getResultsLimit()
Gets the maximum number of autocomplete results to display.