Quiz
5.3 Alternative Views
Questions in this quiz (3)
1How is the JSON view used? (1)
- AThe template filename must end in .json
- BThe third parameter of method assign() of the view must be true
- CThe initializeAction() in the controller requires the parameter $json = true
- DThe property $defaultViewObjectName can be used to create a JSON response by default
- EA directory View must exist inside Classes, which contains a file JsonView.php
2What is the output of the following code snippet that uses Extbase’s JSON view? (1)
use \TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use \TYPO3\CMS\Extbase\Mvc\View\JsonView;
class ExampleController extends ActionController
{
/**
* @var \TYPO3\CMS\Extbase\Mvc\View\JsonView
*/
protected $defaultViewObjectName = JsonView::class;
public function showAction()
{
$data = ['foo' => 'bar'];
$this->view->assign('value', $data);
}
}- AThe JSON payload: {"value": ["foo": "bar"]}
- BThe JSON payload: {"foo": "bar"}
- CThe JSON payload: [foo = "bar"]
- DA serialized array: a:1:{s:3:"foo";s:3:"bar";}
- EAn empty serialized array: a:0:{}
3What is the purpose of the function call setVariablesToRender() of the JSON view in Extbase? (1)
- AThis is required to instruct the JSON view to render variable names other than value
- BThis is required to instruct the JSON view to render multidimensional arrays
- CThis is required to instruct the JSON view to render data types other than arrays
- DThis can be used to switch between JSON, HTML, XML, etc. formats on a case-by-case basis
Information
- Description
- User has deleted their subject information Quiz on 5.3 Alternative Views, created by Deleted user on 27/04/2022.
- Author
- Deleted user
- Language
- English
- Views
- 28
- History
- Created on 27 Apr 2022 · updated on 27 Apr 2022
- Tags
- Rating
- No ratings yet Rate this quiz