data['renderData']['fieldControlOptions']; $parameterArray = $this->data['parameterArray']; // Handle options and fallback $title = $options['title'] ?? 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.list'; $table = ''; if (isset($options['table'])) { // Table given in options - use it $table = $options['table']; } elseif ($parameterArray['fieldConf']['config']['type'] === 'group' && !empty($parameterArray['fieldConf']['config']['allowed']) ) { // Use first table from allowed list if specific table is not set in options $allowedTables = GeneralUtility::trimExplode(',', $parameterArray['fieldConf']['config']['allowed'], true); $table = array_pop($allowedTables); } elseif ($parameterArray['fieldConf']['config']['type'] === 'select' && !empty($parameterArray['fieldConf']['config']['foreign_table']) ) { // Use foreign_table if given for type=select $table = $parameterArray['fieldConf']['config']['foreign_table']; } if (empty($table)) { // Still no table - this element can not handle the list control. return []; } // Target pid of new records is current pid by default $pid = $this->data['effectivePid']; if (isset($options['pid'])) { // pid configured in options - use it $pid = $options['pid']; } elseif ( $this->data['tcaSchemata']->has($table) && ($this->data['tcaSchemata']->get($table)->getRawConfiguration()['rootLevel'] ?? false) === 1 ) { // Target table can only exist on root level - set 0 as pid $pid = 0; } $urlParameters = [ 'P' => [ 'params' => [ 'table' => $table, 'pid' => $pid, ], 'table' => $this->data['tableName'], 'field' => $this->data['fieldName'], 'uid' => $this->data['databaseRow']['uid'], 'returnUrl' => $this->data['returnUrl'], ], ]; $id = StringUtility::getUniqueId('t3js-formengine-fieldcontrol-'); return [ 'iconIdentifier' => 'actions-list-alternative', 'title' => $title, 'linkAttributes' => [ 'id' => $id, 'href' => (string)$this->uriBuilder->buildUriFromRoute('wizard_list', $urlParameters), ], 'javaScriptModules' => [ JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-control/list-module.js')->instance('#' . $id), ], ]; } }