Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
appearance
appearance
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display
Properties that only apply to how the field is displayed in the backend.
prefix
-
- Path
-
$GLOBALS['TCA'][$table]['columns'][$field]['config']['appearance']
- type
-
userFunction
- Scope
-
Display
Provides a string that is displayed in front of the input field.
Assign a user function. It receives two arguments:
- The first argument is the parameters array containing the site object, the language id, the current table and the current row.
- The second argument is the reference object
Tca
.Slug
The user function should return the string which is then used for display purposes.
Example
[
'columns' => [
'slug_1' => [
'exclude' => 1,
'label' => 'slug_1',
'description' => 'field description',
'config' => [
'type' => 'slug',
'generatorOptions' => [
'fields' => [
'input_1',
'input_2',
],
'fieldSeparator' => '/',
'prefixParentPageSlug' => true,
'replacements' => [
'/' => '',
],
],
'appearance' => [
'prefix' => 'TYPO3\\CMS\\Styleguide\\UserFunctions\\FormEngine\\SlugPrefix->getPrefix',
],
'fallbackCharacter' => '-',
'eval' => 'uniqueInSite',
'default' => '',
],
],
],
]
The user function can be implemented like this:
<?php
declare(strict_types=1);
namespace TYPO3\CMS\Styleguide\UserFunctions\FormEngine;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A user function to compare two fields
*/
use TYPO3\CMS\Backend\Form\FormDataProvider\TcaSlug;
class SlugPrefix
{
public function getPrefix(array $parameters, TcaSlug $reference): string
{
return 'custom slug prefix';
}
}