PHP 클래스 Dispatcher

저자: liu21st ([email protected])
상속: extends Base
파일 보기 프로젝트 열기: silverstripe/deploynaut 1 사용 예제들

공개 메소드들

메소드 설명
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.

보호된 메소드들

메소드 설명
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

메소드 상세

asJSON() 공개 메소드

Automatically updates the security token and proxy pending redirects.
사용 중단: the use of getAPIResponse() is encouraged
public asJSON ( array $data = [] ) : SS_HTTPResponse
$data array Data to be passed to the frontend.
리턴 SS_HTTPResponse

asJSONFormFieldErrors() 공개 메소드

Return field-specific errors as AJAX response.
public asJSONFormFieldErrors ( integer $code, array $fieldErrors ) : SS_HTTPResponse
$code integer HTTP status code.
$fieldErrors array FieldName => message structure.
리턴 SS_HTTPResponse

asJSONValidatorErrors() 공개 메소드

Return the validator errors as AJAX response.
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"}]
리턴 SS_HTTPResponse

checkSecurityToken() 보호된 메소드

또한 보기: getSecurityToken()
protected checkSecurityToken ( )

getAPIResponse() 보호된 메소드

Return an XHR response object without any CSRF token information
protected getAPIResponse ( array $output, integer $statusCode ) : SS_HTTPResponse
$output array
$statusCode integer
리턴 SS_HTTPResponse

getFormData() 보호된 메소드

Decode the data submitted by the Form.jsx control.
protected getFormData ( ) : array
리턴 array

getModel() 추상적인 공개 메소드

Generate the data structure used by the frontend component.
abstract public getModel ( string $name ) : array
$name string of the component
리턴 array

getReactComponent() 공개 메소드

Usage: $getReactComponent(YourComponent);
public getReactComponent ( string $name ) : string
$name string Used to name the DOM elements and obtain the initial model.
리턴 string A snippet good for adding to a SS template.

getSecurityToken() 보호된 메소드

We do this by giving the token a separate name. Don't manually reset() this token, that will cause issues when people have several tabs open. The token will be recreated when the user session times out.
protected getSecurityToken ( ) : SecurityToken
리턴 SecurityToken

stripNonPrintables() 보호된 메소드

Remove control characters from the input.
protected stripNonPrintables ( $val ) : string | array
리턴 string | array

trimWhitespace() 보호된 메소드

protected trimWhitespace ( $val ) : string | array
리턴 string | array