Neos\Flow\Mvc\View\JsonView::render PHP Method

render() public method

Transforms the value view variable to a serializable array represantion using a YAML view configuration and JSON encodes the result.
public render ( ) : string
return string The JSON encoded variables
    public function render()
    {
        $this->controllerContext->getResponse()->setHeader('Content-Type', 'application/json');
        $propertiesToRender = $this->renderArray();
        $options = $this->getOption('jsonEncodingOptions');
        return json_encode($propertiesToRender, $options);
    }

Usage Example

 /**
  * Configures rendering according to the set variable(s) and calls
  * render on the parent.
  *
  * @return string
  */
 public function render()
 {
     if (isset($this->variables['assets'])) {
         $this->setConfiguration(array('assets' => array('_descendAll' => array('_only' => array('label', 'tags', 'identifier')))));
         $this->setVariablesToRender(array('assets'));
     } else {
         $this->setConfiguration(array('asset' => array('_only' => array('label', 'tags', 'identifier'))));
         $this->setVariablesToRender(array('asset'));
     }
     return parent::render();
 }
All Usage Examples Of Neos\Flow\Mvc\View\JsonView::render