5.3 Alternative Views

Beschreibung

TYPO3 CD 2020 (zweite Auflage) Quiz am 5.3 Alternative Views, erstellt von Pascal Bartl am 09/04/2021.
Pascal Bartl
Quiz von Pascal Bartl, aktualisiert more than 1 year ago
Pascal Bartl
Erstellt von Pascal Bartl vor etwa 3 Jahre
0
0

Zusammenfassung der Ressource

Frage 1

Frage
How is the JSON view used? (1)
Antworten
  • 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

Frage 2

Frage
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); } }
Antworten
  • 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:{}

Frage 3

Frage
What is the purpose of the function call setVariablesToRender() of the JSON view in Extbase? (1)
Antworten
  • 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
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Kleines Biologie-Quiz
AntonS
PuKW STEP 4 (mögliche Prüfungsfragen/Prüfungsvorbereitung)
frau planlos
Einführung für GoConqr - Ausführlich
Laura Overhoff
Folien: Systemtheorie
tschiggli
Sops EURO-FH B.Sc.
??? ???
KORRE - Megaprüfungsfragen
Martina Brunner
Vetie Para Tropfpräparate
Kristin E
Repro 2016 Vetie
Julia To
Vetie Fleisch 2019/2020 (Matrikel 14)
Maite J
GETH2.3
Katrin Dolle