appearance

appearance
Type:array
Scope:Display

Properties that only apply to how the field is displayed in the backend.

appearance:prefix
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 TcaSlug.

The user function should return the string which is then used for display purposes.

Example

      'slug_1' => [ 
         'exclude' => 1,
         'label' => 'slug_1',
         'description' => 'field description',
         'config' => [ 
            'type' => 'slug',
            'generatorOptions' => [ 
               'fields' => [ 
                  '0' => 'input_1',
                  '1' => 'input_2',
               ],
               'fieldSeparator' => '/',
               'prefixParentPageSlug' => true,
               'replacements' => [ 
                  '/' => '',
               ],
            ],
            'appearance' => [ 
               'prefix' => 'TYPO3\CMS\Styleguide\UserFunctions\FormEngine\SlugPrefix->getPrefix',
            ],
            'fallbackCharacter' => '-',
            'eval' => 'uniqueInSite',
            'default' => '',
         ],
      ],
      // Example from extension "styleguide", table "tx_styleguide_elements_slugs"

The user function can be implemented like this:

 * 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';
    }
}