$fieldConfig) { if (($fieldConfig['config']['type'] ?? '') !== 'slug') { continue; } $prefixUserFunc = $fieldConfig['config']['appearance']['prefix'] ?? ''; if ($prefixUserFunc !== '') { $parameters = [ 'site' => $site, 'languageId' => $languageId, 'table' => $table, 'row' => $row, 'fieldName' => $fieldName, 'config' => $fieldConfig['config'], ]; $prefix = GeneralUtility::callUserFunction($prefixUserFunc, $parameters, $this); } elseif ($site instanceof SiteInterface) { // default behaviour used for pages $prefix = $this->getPrefixForSite($site, $languageId); } else { // no site found, so we cannot determine a prefix $prefix = ''; } $result['customData'][$fieldName]['slugPrefix'] = $prefix; $result['processedTca']['columns'][$fieldName]['config']['appearance']['prefix'] = $prefix; } return $result; } /** * Render the prefix for the input field. */ protected function getPrefixForSite(SiteInterface $site, int $languageId): string { try { $language = ($languageId < 0) ? $site->getDefaultLanguage() : $site->getLanguageById($languageId); $base = $language->getBase(); $prefix = rtrim((string)$base, '/'); if ($prefix !== '' && empty($base->getScheme()) && $base->getHost() !== '') { $prefix = 'http:' . $prefix; } } catch (\InvalidArgumentException $e) { // No site found $prefix = ''; } return $prefix; } }