Given two action controllers
- One extending
- One implementing
Both simply return the value of
Both have a layout XML file matching the handles for the respective requests. Both of the files extend the
For the first action controller extending
Action the result is (as expected) a rendered Magento page with an empty content area.
But for the second controller implementing the interface a completely white page is displayed (technically only the root template is rendered).
The only difference I was able to see was that the second controller does not dispatch the events triggered in
Action::dispatch(). But even after also dispatching the same events there was no difference in the rendered page.
Debugging further I noticed in
\Magento\Framework\View\File\Collector\Base::getFiles() the theme was not properly initialized.
$area = $theme->getData('area'); returned
Replacing that with
$area = $theme->getArea() fixed that. Now the paths to the base view files are correct, but no theme files are loaded.
\Magento\Framework\View\File\Collector\ThemeModular::getFiles() the line
$themePath = $theme->getFullPath(); returns
Now, finally, my question is: where is the theme initialized? Further questions are why does that happen for the first action controller and not for the second?