MVC and request handling · Question 4 of 12
How does an Extbase controller pass data to its Fluid template?
2 answers are correct. Easy
Show answer
Answer
- B $this->view->assignMultiple(['conferences' => $conferences, 'title' => $title]);
- D $this->view->assign('conferences', $conferences);
Explanation
Template variables are assigned through the view object: assign() sets one variable, assignMultiple() sets several at once. The name becomes the template variable, in the example {conferences}, which you can iterate with <f:for each="{conferences}" as="conference">. Values needed in every action are assigned once in initializeView(). $this->settings, in contrast, is the TypoScript or FlexForm configuration of the plugin and not a place to store data from the controller.