/** * Handle AJAX calls to dynamically load the form fields of a given record. * (basically a copy of "createNewRecord") * Normally this method is never called from inside TYPO3. Always from outside by AJAX. * * @param string $domObjectId: The calling object in hierarchy, that requested a new record. * @return array An array to be used for JSON */ function getRecordDetails($domObjectId) { // the current table - for this table we should add/import records $current = $this->inlineStructure['unstable']; // the parent table - this table embeds the current table $parent = $this->getStructureLevel(-1); // get TCA 'config' of the parent table if (!$this->checkConfiguration($parent['config'])) { return $this->getErrorMessageForAJAX('Wrong configuration in table ' . $parent['table']); } $config = $parent['config']; // set flag in config so that only the fields are rendered $config['renderFieldsOnly'] = true; $collapseAll = isset($config['appearance']['collapseAll']) && $config['appearance']['collapseAll']; $expandSingle = isset($config['appearance']['expandSingle']) && $config['appearance']['expandSingle']; // Put the current level also to the dynNestedStack of TCEforms: $this->fObj->pushToDynNestedStack('inline', $this->inlineNames['object']); $record = $this->getRecord($this->inlineFirstPid, $current['table'], $current['uid']); // the HTML-object-id's prefix of the dynamically created record $objectPrefix = $this->inlineNames['object'] . self::Structure_Separator . $current['table']; $objectId = $objectPrefix . self::Structure_Separator . $record['uid']; $item = $this->renderForeignRecord($parent['uid'], $record, $config); if ($item === false) { return $this->getErrorMessageForAJAX('Access denied'); } // Encode TCEforms AJAX response with utf-8: $item = $GLOBALS['LANG']->csConvObj->utf8_encode($item, $GLOBALS['LANG']->charSet); $jsonArray = array('data' => $item, 'scriptCall' => array('inline.domAddRecordDetails(\'' . $domObjectId . '\',\'' . $objectPrefix . '\',' . ($expandSingle ? '1' : '0') . ',json.data);')); $this->getCommonScriptCalls($jsonArray, $config); // Collapse all other records if requested: if (!$collapseAll && $expandSingle) { $jsonArray['scriptCall'][] = 'inline.collapseAllRecords(\'' . $objectId . '\',\'' . $objectPrefix . '\',\'' . $record['uid'] . '\');'; } // Remove the current level also from the dynNestedStack of TCEforms: $this->fObj->popFromDynNestedStack(); // Return the JSON array: return $jsonArray; }