5.3 Alternative Views

Descripción

TYPO3 CD 2020 (zweite Auflage) Test sobre 5.3 Alternative Views, creado por Pascal Bartl el 09/04/2021.
Pascal Bartl
Test por Pascal Bartl, actualizado hace más de 1 año
Pascal Bartl
Creado por Pascal Bartl hace más de 3 años
0
0

Resumen del Recurso

Pregunta 1

Pregunta
How is the JSON view used? (1)
Respuesta
  • The template filename must end in .json
  • The third parameter of method assign() of the view must be true
  • The initializeAction() in the controller requires the parameter $json = true
  • The property $defaultViewObjectName can be used to create a JSON response by default
  • A directory View must exist inside Classes, which contains a file JsonView.php

Pregunta 2

Pregunta
What 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); } }
Respuesta
  • The JSON payload: {"value": ["foo": "bar"]}
  • The JSON payload: {"foo": "bar"}
  • The JSON payload: [foo = "bar"]
  • A serialized array: a:1:{s:3:"foo";s:3:"bar";}
  • An empty serialized array: a:0:{}

Pregunta 3

Pregunta
What is the purpose of the function call setVariablesToRender() of the JSON view in Extbase? (1)
Respuesta
  • This is required to instruct the JSON view to render variable names other than value
  • This is required to instruct the JSON view to render multidimensional arrays
  • This is required to instruct the JSON view to render data types other than arrays
  • This can be used to switch between JSON, HTML, XML, etc. formats on a case-by-case basis
Mostrar resumen completo Ocultar resumen completo

Similar

Chino Mandarín Básico
Diego Santos
Anatomía cabeza
maca.s
Apuntes sobre Modelos Atómicos - Rutherford y Bohr
Raúl Fox
Preposiciones en inglés
Lolo Reyes
Disoluciones Químicas
maya velasquez
Lenguas que influyen en el español
dorydan01
SISTEMA ENDOCRINO
fran alarcon
ARTE DE GRECIA
Alex Velazquez
Sistema Economico
bella_colindres
Línea del Tiempo: La Creación de la Tierra
Valdeavellano
REPRODUCTION I
Nuria Prado Álvarez