For my TYPO3 Extbase Extension I want to do some kind of pagination. The ajax call and everything else is fine so far. But when I try to access the $this->settings
Array during the ajax call, where the flexform frontend plugin values are stored, I always get null
. The part looks like this:
$limit = $this->settings['result']['amount'];
$orderType = $this->settings['order']['type'];
$orderFields = $this->settings['additionorder']['fields'];
$formArr = array();
$this->request->hasArgument('offset') ? $offset = $this->request->getArgument('offset') : null;
$forms = $this->formRepository->findFormsChunked(
$orderFields, $orderType, $limit, $offset
);
foreach ($forms as $key => $form) {
$formArr[] = array(
'formUid' => $form->getUid(),
'formName' => $form->getName(),
'formFile' => $form->getFile()->getOriginalResource()->getPublicUrl(),
'formType' => $form->getFormtype()->getUid()
);
}
return json_encode($formArr);
And $this->settings is null during my ajax call, but I can't imagine why. Are the values only available during the rendering process, which is not happening during the ajax call?
Thanks for the help.
UPDATE
As far as I know, the flexform values are only passed to the selected controller-actions (i.e. displaycond) like this:
<displayCond>FIELD:switchableControllerActions:=:Controller->ajax:AND:FIELD:switchableControllerActions:=:Controller->normal</displayCond>
and in the select menu:
<numIndex index="1">
<numIndex index="0">LLL:EXT:ext_formpool/Resources/Private/Language/locallang.xlf:name</numIndex>
<numIndex index="1">Controller->normal;Controller->ajax</numIndex>
</numIndex>
So the values should be passed to the ajaxAction too? At the moment they are not available...
Solution
Unfortunately, it simply doesn't work if you do ajax calls with a separate page type. The flexform is stored in the database and gets only parsed during the framework-loading process. You can check this by including the configuration manager and try to parse the content object's "pi_flexform" field. Or you inject the flexformservice, which is also not loaded during the ajax call. You have to use the eID-mechanism to achieve this.