OP\AutocompleteSuggestField
A generic and reusable ajax based auto complete suggest suggestion select box.
It enables you have a friendly suggest box in the CMS or front end.
- Author: Torleif West <torleifw@op.ac.nz>
Synopsis
class AutocompleteSuggestField
extends TextField
{
- // members
- protected $controller;
- protected $placeholder;
- protected $displayname;
- protected $dataobject;
- protected $parent;
- private static array $casting = ;
- // methods
- public void __construct()
- public void setDataObject()
- public AutocompleteSuggestField setValue()
- public int Value()
- public string getDisplayName()
- public string getCacheKey()
- public mixed dataValue()
- public string getAutoCompleteActionName()
- public string getAutoCompleteURL()
- public void getDataListName()
- public void getPlaceholderText()
- public void setPlaceholderText()
- public void getAttributes()
- public string getTargetClassName()
- public array AttributesDisplayHTML()
Hierarchy
Extends
- SilverStripe\Forms\TextField
Members
private
- $casting
protected
- $controller
- $dataobject
- $displayname
- $parent
- $placeholder
Methods
public
- __construct() — Builds the autocomplete suggest field. includes the needed js and checks to make sure you've got the allowed action public.
- AttributesDisplayHTML() — Creates paramaters used to build the input field for ajax search
- Value() — Returns the ID value
- dataValue() — Returns the field value suitable for insertion into the data object.
- getAttributes()
- getAutoCompleteActionName() — The name of the action that must live on the controller. it will be used to query the action
- getAutoCompleteURL() — Returns a URL for ajax
- getCacheKey() — Returns a unqiue cache string to identify this field
- getDataListName()
- getDisplayName() — Returns the user friendly text name (e.g. John Smith)
- getPlaceholderText()
- getTargetClassName() — Returns a string of the fully qualified classname used e.g. SilverStripe\Security\Member
- setDataObject() — Sets the foreign relationship dataobject
- setPlaceholderText()
- setValue() — There are three types of data we can take, 1. some data from an array 2. just some text which will be used for both the id and name value