Examples

Slug field

This example uses a custom slug prefix hook via config['appearance']['prefix'] to adapt the displayed prefix. It takes the two fields input_1 and input_2 into account for generating the slug.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_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' => '',
            ],
        ],
    ],
]
Copied!

Another slug field

This example limits the length of the slug to 50 characters. It takes only the field input_1 into account for generating the slug.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_2' => [
            'label' => 'slug_2',
            'config' => [
                'type' => 'slug',
                'size' => 50,
                'generatorOptions' => [
                    'fields' => [
                        'input_1',
                    ],
                    'fieldSeparator' => '/',
                    'prefixParentPageSlug' => true,
                ],
                'fallbackCharacter' => '-',
                'eval' => 'uniqueInSite',
                'default' => '',
            ],
        ],
    ],
]
Copied!