';
$result['html'] = implode(LF, $html);
return $result;
}
/**
* Try to resolve a configured default entry point - page / folder
* to be expanded - and add it to the attributes if found.
*/
protected function addEntryPoint(string $tableName, array $fieldConfig, array $attributes): array
{
if (!isset($fieldConfig['elementBrowserEntryPoints']) || !is_array($fieldConfig['elementBrowserEntryPoints'])) {
// Early return in case no entry points are defined
return $attributes;
}
// Fetch the configured value (which might be a marker) - falls back to _default
$entryPoint = (string)($fieldConfig['elementBrowserEntryPoints'][$tableName] ?? $fieldConfig['elementBrowserEntryPoints']['_default'] ?? '');
if ($entryPoint === '') {
// In case no entry point exists for the given table and also no default is defined, return
return $attributes;
}
// Check and resolve possible marker
if (str_starts_with($entryPoint, '###') && str_ends_with($entryPoint, '###')) {
if ($entryPoint === '###CURRENT_PID###') {
// Use the current pid
$entryPoint = (string)$this->data['effectivePid'];
} elseif ($entryPoint === '###SITEROOT###' && ($this->data['site'] ?? null) instanceof Site) {
// Use the root page id from the current site
$entryPoint = (string)$this->data['site']->getRootPageId();
} else {
// Check for special TSconfig marker
$TSconfig = FormEngineUtility::getTCEFORM_TSconfig($this->data['tableName'], ['pid' => $this->data['effectivePid']]);
$keyword = substr($entryPoint, 3, -3);
if (str_starts_with($keyword, 'PAGE_TSCONFIG_')) {
$entryPoint = (string)($TSconfig[$this->data['fieldName']][$keyword] ?? '');
} else {
$entryPoint = (string)($TSconfig['_' . $keyword] ?? '');
}
}
}
// Add the entry point to the attribute - if resolved
if ($entryPoint !== '') {
$attributes['data-entry-point'] = $entryPoint;
}
return $attributes;
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}