Sulu\Bundle\PreviewBundle\Preview\PreviewInterface::update PHP Method

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
    public function update($token, $webspaceKey, $locale, array $data);

Usage Example

Example #1
0
 /**
  * Update preview with given parameter.
  *
  * @param MessageHandlerContext $context
  * @param array $message
  *
  * @return array
  */
 private function update(MessageHandlerContext $context, $message)
 {
     $changes = $this->preview->update($context->get('previewToken'), $message['webspaceKey'], $context->get('locale'), $message['data']);
     return ['command' => 'update', 'data' => $changes, 'msg' => 'OK'];
 }