src/forms/HasOneAutocompleteField.php
public function search(HTTPRequest $request)
    {
        // Check form field state
        if($this->isDisabled() || $this->isReadonly()) {
            return $this->httpError(403);
        }

        $query = $request->getVar('query');

        // use callbacks if they're set, otherwise used this class's methods for search and processing
        if ($this->getSearchCallback()) {
            $results = call_user_func($this->getSearchCallback(), $query, $this);
        } else {
            $results = $this->getResults($query);
        }

        if ($this->getProcessCallback()) {
            $json = call_user_func($this->getProcessCallback(), $results, $this);
        } else {
            $json = $this->processResults($results);
        }

        return Convert::array2json($json);
    }
public function search(HTTPRequest $request)
    {
        // Check form field state
        if($this->isDisabled() || $this->isReadonly()) {
            return $this->httpError(403);
        }

        $query = $request->getVar('query');

        // use callbacks if they're set, otherwise used this class's methods for search and processing
        if ($this->getSearchCallback()) {
            $results = call_user_func($this->getSearchCallback(), $query, $this);
        } else {
            $results = $this->getResults($query);
        }

        if ($this->getProcessCallback()) {
            $json = call_user_func($this->getProcessCallback(), $results, $this);
        } else {
            $json = $this->processResults($results);
        }

        return Convert::array2json($json);
    }
public function search ( HTTPRequest $ request ) { // Check form field state if ( $ this -> isDisabled ( ) || $ this -> isReadonly ( ) ) { return $ this -> httpError ( 403 ) ; } $ query = $ request -> getVar ( 'query' ) ; // use callbacks if they're set, otherwise used this class's methods for search and processing if ( $ this -> getSearchCallback ( ) ) { $ results = call_user_func ( $ this -> getSearchCallback ( ) , $ query , $ this ) ; } else { $ results = $ this -> getResults ( $ query ) ; } if ( $ this -> getProcessCallback ( ) ) { $ json = call_user_func ( $ this -> getProcessCallback ( ) , $ results , $ this ) ; } else { $ json = $ this -> processResults ( $ results ) ; } return Convert :: array2json ( $ json ) ; }
The action that handles AJAX search requests
@param  SS_HTTPRequest $request
@return json
The action that handles AJAX search requests