GridFieldAddExistingAutocompleter
class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridField_ActionProvider, GridField_DataManipulator, GridField_URLHandler (View source)
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
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
__construct(string $targetFragment = 'before', array $searchFields = null)
array
getHTMLFragments(GridField $gridField)
array
getActions($gridField)
handleAction(GridField $gridField, string $actionName, array $arguments, array $data)
Manipulate the state to add a new relation
SS_List
getManipulatedData(GridField $gridField, SS_List $dataList)
If an object ID is set, add the object to the list
array
getURLHandlers(GridField $gridField)
string
doSearch(GridField $gridField, HTTPRequest $request)
Returns a json array of a search results that can be used by for example Jquery.ui.autosuggestion
$this
setResultsFormat(string $format)
string
getResultsFormat()
setSearchList(SS_List $list)
Sets the base list instance which will be used for the autocomplete search.
$this
setSearchFields(array $fields)
array
getSearchFields()
array|null
scaffoldSearchFields(string $dataClass)
Detect searchable fields and searchable relations.
Falls back to {@link DataObject->summaryFields()} if no custom search fields are defined.
string
getPlaceholderText(string $dataClass)
$this
setPlaceholderText(string $text)
int
getResultsLimit()
Gets the maximum number of autocomplete results to display.