PHP Interface Sulu\Bundle\PreviewBundle\Preview\PreviewInterface

Show file Open project: sulu/sulu Interface Usage Examples

Public Methods

Method Description
exists ( string $token ) : boolean Returns true if such a session exists.
render ( string $token, string $webspaceKey, string $locale ) : string Returns rendered preview-session.
start ( string $objectClass, string $id, integer $userId, string $webspaceKey, string $locale, array $data = [] ) : string Starts a new preview session.
stop ( string $token ) Stops the preview-session and deletes the data.
update ( string $token, string $webspaceKey, string $locale, array $data ) : array Updates given data in the preview-session.
updateContext ( string $token, string $webspaceKey, string $locale, array $context, array $data ) : string Updates given context and restart preview with given data.

Method Details

exists() public method

Returns true if such a session exists.
public exists ( string $token ) : boolean
$token string To identify the preview-session
return boolean

render() public method

Returns rendered preview-session.
public render ( string $token, string $webspaceKey, string $locale ) : string
$token string To identify the preview-session
$webspaceKey string Webspace to render object
$locale string
return string Complete html response

start() public method

Starts a new preview session.
public start ( string $objectClass, string $id, integer $userId, string $webspaceKey, string $locale, array $data = [] ) : string
$objectClass string Class of object
$id string Identifier of object
$userId integer
$webspaceKey string
$locale string
$data array Initial data will be set on the object
return string Token can be used to reuse this preview-session

stop() public method

Stops the preview-session and deletes the data.
public stop ( string $token )
$token string To identify the preview-session

update() public method

Updates given data in the preview-session.
public update ( string $token, string $webspaceKey, string $locale, array $data ) : array
$token string To identify the preview-session
$webspaceKey string Webspace to render object
$locale string
$data array Data which will be updated before re-rendering content
return array Changes for the rendering

updateContext() public method

Updates given context and restart preview with given data.
public updateContext ( string $token, string $webspaceKey, string $locale, array $context, array $data ) : string
$token string To identify the preview-session
$webspaceKey string Webspace to render object
$locale string
$context array Contains contextual data to restart preview
$data array Data which will be updated before re-rendering content
return string Complete html response