MVC and request handling · Question 3 of 12
Which statement does a typical Extbase action end with so that its Fluid template is rendered and output?
1 answer is correct. Easy
Show answer
Answer
- B return $this->htmlResponse();
Explanation
Every Extbase action must return a PSR-7 ResponseInterface. $this->htmlResponse() without an argument renders the Fluid template belonging to the action and wraps the result in a text/html response; with a string argument, that string is used as the body instead of the template. return $this->view->render(); is tempting but only returns a string – if an action returns anything other than a response, Extbase throws a RuntimeException. jsonResponse() is intended for JSON output, for example together with JsonView.