module - TYPO3 pass controller context to ajax request -
i working on typo3-backend-module. main "overview"-action allows upload file via ajax upload, gets processed in 1 of controllers.
the corresponding controller-action instantiates standaloneview, renders , writes rendered content response body. problem is, have no controllercontext set in generated content, therefore form, should trigger different extbase action, in rendered content not work, because modulename not set.
can tell me how possibly get/pass controllercontext, make available in controller action, called via ajax ? best regards , in advance, oliver !
the main problem here modules don't use standard view implementation - in default implementation, wrap around standaloneview definition has no controller context.
that being said, if can change way view wraps around standaloneview, controller context can copied doing:
$view->getrenderingcontext()->setcontrollercontext($parentview->getrenderingcontext()->getcontrollercontext()); alternatively may want copy entire rendering context rather controller context.
advise applies typo3v8 only. on 7.6 need copy request instead.
for usages outside of mvc context need manually pass original controller context values such controller name , module name. means values must part of link create , must read receiving code (in whichever way code's context requires) , manually assigned request create , pass sub-view. note necessary if mvc context values change - if call same action next, can right result hardcoding desired extension name, module name, controller name , action in form/link in template render ajax controller.
Comments
Post a Comment