Add your own tags

Here's an example how to add a abbr html tag, remove the br tag and change the default label of the sup tag

The resulting dropdown after the example code has been added

The resulting dropdown after the example code has been added

Add or remove tags

To add your own tags, you will need to create an EventListener that listens to the AllowedTagsEvent

EventListener to change the available tags
<?php

namespace MyVendor\MyExt\EventListener;

use TRAW\SupHeader\Events\AllowedTagsEvent;

class MyTagsEventListener
{
    public function __invoke(AllowedTagsEvent $event)
    {
        //add a single html tag
        $event->addAllowedTag('abbr');

        //remove a single html tag
        $event->removeAllowedTag('br');
    }
}
Copied!

Add or change labels (PSR-14 event)

If you want to add a label for your tag or change the default labels, add another EventListener that listens to the LabelFileEvent

EventListener to add and change labels
<?php

namespace MyVendor\MyExt\EventListener;

use TRAW\SupHeader\Events\LabelFileEvent;

class MyLabelsEventListener
{
    public function __invoke(LabelFileEvent $event)
    {
        $event->addLabelFile('EXT:my_ext/Resources/Private/Language/mylabels.xlf');
    }
}
Copied!
The corresponding label addLabelFile
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file source-language="en" datatype="plaintext" original="EXT:myext/Resources/Private/Language/locallang.xlf"
          date="2025-01-26T20:22:32Z" product-name="sup_header">
        <header/>
        <body>
            <trans-unit id="supheader.label.sup" resname="supheader.label.sup">
                <source>Custom text</source>
            </trans-unit>
            <trans-unit id="supheader.label.abbr" resname="supheader.label.abbr">
                <source>Abbreviation</source>
            </trans-unit>
        </body>
    </file>
</xliff>
Copied!

TYPO3 docs - Events

Add or change labels (locallangOverride)

There's also the possibility to override the locallang labels. TYPO3 docs - Custom translations

In your ext_localconf.php add

ext_localconf.php
 $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:sup_header/Resources/Private/Language/locallang.xlf'][]
        = 'EXT:my_ext/Resources/Private/Language/Overrides/locallang-supheader.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['de']['EXT:sup_header/Resources/Private/Language/locallang.xlf'][]
    = 'EXT:my_ext/Resources/Private/Language/Overrides/de.locallang-supheader.xlf';
Copied!