\MovieAutoComplete
Class MovieAutoComplete
This class implements an Autocomplete field which is used to collect suggestions from the open movie database
api. This form field includes the @see MovieAutoComplete.js javascript file which handles the ajax calls to
the API and to update the form after the user has selected a record.
This class is based on "tractorcow/silverstripe-autocomplete" which implements a jquery autocomplete, provinding
an field with can suggest results stored in the CMS (i.e. DataObjects). As we require to load the content from
a 3rd party system, the original form field needed to be altered significantly which resulted in this
MovieAutoComplete formfield. Special thanks to tractorcow.
Synopsis
class MovieAutoComplete
extends TextField
{
- // members
- private static string $suggestURL = '';
- // methods
- public array getAttributes()
- public string Type()
- public string Field()
- public string getSuggestURL()
Hierarchy
Extends
- TextField
Members
private
- $suggestURL — string
Methods
public
- Field() — Renders the autocomplete form field.
- Type() — Add autocomplete and text classes to the dom element.
- getAttributes()
- getSuggestURL() — Get the URL used to fetch Autocomplete suggestions.