/** * Renders the not found view * * @return string The rendered view * @throws \TYPO3\Flow\Mvc\Exception if no request has been set * @api */ public function render() { if (!is_object($this->controllerContext->getRequest())) { throw new \TYPO3\Flow\Mvc\Exception('Can\'t render view without request object.', 1192450280); } $template = file_get_contents($this->getTemplatePathAndFilename()); $template = str_replace('{BASEURI}', $this->controllerContext->getRequest()->getHttpRequest()->getBaseUri(), $template); foreach ($this->variablesMarker as $variableName => $marker) { $variableValue = isset($this->variables[$variableName]) ? $this->variables[$variableName] : ''; $template = str_replace('{' . $marker . '}', $variableValue, $template); } $this->controllerContext->getResponse()->setStatus(404); return $template; }
/** * Transforms the value view variable to a serializable * array represantion using a YAML view configuration and JSON encodes * the result. * * @return string The JSON encoded variables * @api */ public function render() { $this->controllerContext->getResponse()->setHeader('Content-Type', 'application/json'); $propertiesToRender = $this->renderArray(); $options = $this->getOption('jsonEncodingOptions'); return json_encode($propertiesToRender, $options); }