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 97
__construct(string $targetFragment = 'before', array $searchFields = null)
at line 108
array
getHTMLFragments(GridField $gridField)
at line 167
array
getActions(GridField $gridField)
at line 180
handleAction(GridField $gridField, string $actionName, array $arguments, array $data)
Manipulate the state to add a new relation
at line 198
SS_List
getManipulatedData(GridField $gridField, SS_List $dataList)
If an object ID is set, add the object to the list
at line 217
array
getURLHandlers(GridField $gridField)
at line 231
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 282
$this
setResultsFormat(string $format)
at line 291
string
getResultsFormat()
at line 302
setSearchList(SS_List $list)
Sets the base list instance which will be used for the autocomplete search.
at line 312
$this
setSearchFields(array $fields)
at line 321
array
getSearchFields()
at line 334
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 373
string
getPlaceholderText(string $dataClass)
at line 413
$this
setPlaceholderText(string $text)
at line 424
int
getResultsLimit()
Gets the maximum number of autocomplete results to display.