ElementalGridFieldAddExistingAutocompleter
class ElementalGridFieldAddExistingAutocompleter extends GridFieldAddExistingAutocompleter (View source)
This class is is responsible for adding objects to another object's has_many and many_many relation, as defined by the RelationList passed to the 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 GridFieldDeleteAction for detaching existing records from a relationship.
For easier setup, have a look at a sample configuration in GridFieldConfig_RelationEditor.
Properties
protected | string | $itemClass | Which template to use for rendering |
from GridFieldAddExistingAutocompleter |
protected | $targetFragment | The HTML fragment to write this component into |
from GridFieldAddExistingAutocompleter | |
protected | SS_List | $searchList | from GridFieldAddExistingAutocompleter | |
protected | array | $searchFields | Define column names which should be included in the search. |
from GridFieldAddExistingAutocompleter |
protected | string | $resultsFormat | from GridFieldAddExistingAutocompleter | |
protected | string | $placeholderText | from GridFieldAddExistingAutocompleter | |
protected | int | $resultsLimit | from GridFieldAddExistingAutocompleter |
Methods
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
Sets the base list instance which will be used for the autocomplete search.
Detect searchable fields and searchable relations.
Details
__construct(string $targetFragment = 'before', array $searchFields = null)
No description
array
getHTMLFragments($gridField)
No description
array
getActions($gridField)
No description
handleAction(GridField $gridField, $actionName, $arguments, $data)
Manipulate the state to add a new relation
DataList
getManipulatedData(GridField $gridField, SS_List $dataList)
If an object ID is set, add the object to the list
getURLHandlers($gridField)
No description
doSearch(GridField $gridField, SS_HTTPRequest $request)
Returns a json array of a search results that can be used by for example Jquery.ui.autosuggestion
$this
setResultsFormat(string $format)
No description
string
getResultsFormat()
No description
setSearchList(SS_List $list)
Sets the base list instance which will be used for the autocomplete search.
setSearchFields(array $fields)
No description
array
getSearchFields()
No description
array|null
scaffoldSearchFields(string $dataClass)
Detect searchable fields and searchable relations.
Falls back to DataObject->summaryFields() if no custom search fields are defined.
string
getPlaceholderText(string $dataClass)
No description
$this
setPlaceholderText(string $text)
No description
int
getResultsLimit()
Gets the maximum number of autocomplete results to display.
$this
setResultsLimit(int $limit)
No description