Method | Description | |
---|---|---|
asJSON ( array $data = [] ) : SS_HTTPResponse | Respond to an AJAX request. | |
asJSONFormFieldErrors ( integer $code, array $fieldErrors ) : SS_HTTPResponse | Return field-specific errors as AJAX response. | |
asJSONValidatorErrors ( integer $code, array $validatorErrors ) : SS_HTTPResponse | Return the validator errors as AJAX response. | |
getModel ( string $name ) : array | Generate the data structure used by the frontend component. | |
getReactComponent ( string $name ) : string | Renders the initial HTML needed to bootstrap the react component. |
Method | Description | |
---|---|---|
checkSecurityToken ( ) | ||
getAPIResponse ( array $output, integer $statusCode ) : SS_HTTPResponse | Return an XHR response object without any CSRF token information | |
getFormData ( ) : array | Decode the data submitted by the Form.jsx control. | |
getSecurityToken ( ) : SecurityToken | We want to separate the dispatchers security token from the static HTML security token since it's possible that they get out of sync with eachother. | |
stripNonPrintables ( $val ) : string | array | Remove control characters from the input. | |
trimWhitespace ( $val ) : string | array |
public asJSONFormFieldErrors ( integer $code, array $fieldErrors ) : SS_HTTPResponse | ||
$code | integer | HTTP status code. |
$fieldErrors | array | FieldName => message structure. |
return | SS_HTTPResponse |
public asJSONValidatorErrors ( integer $code, array $validatorErrors ) : SS_HTTPResponse | ||
$code | integer | HTTP status code. |
$validatorErrors | array | Result of calling Validator::validate, e.g. [{"fieldName":"Name","message":"Message.","messageType":"bad"}] |
return | SS_HTTPResponse |
protected getAPIResponse ( array $output, integer $statusCode ) : SS_HTTPResponse | ||
$output | array | |
$statusCode | integer | |
return | SS_HTTPResponse |
protected getFormData ( ) : array | ||
return | array |
public getReactComponent ( string $name ) : string | ||
$name | string | Used to name the DOM elements and obtain the initial model. |
return | string | A snippet good for adding to a SS template. |
protected getSecurityToken ( ) : SecurityToken | ||
return | SecurityToken |
protected stripNonPrintables ( $val ) : string | array | ||
return | string | array |
protected trimWhitespace ( $val ) : string | array | ||
return | string | array |