Search code examples
typo3typo3-9.xtypo3-extensions

How to overwrite backend / tabulator labels in page properties?


I have added new input fields to the page properties (below the categories):

TCA/Overrides/pages.php

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
    'pages',
    '--palette--;My palette label;eventdetails',
    '1', // List of specific types to add the field list to. (If empty, all type entries are affected)
    'after:categories' // Insert fields before (default) or after one, or replace a field
);

// Add the new palette:
$GLOBALS['TCA']['pages']['palettes']['eventdetails'] = array(
    'showitem' => 'event_location,event_organizer,event_additional_info'
);

The tabulator label "Category" from LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category is now no longer suitable (I would prefer "Event properties") . Is it possible to overrite sys_category.tabs.category somehow?


Solution

  • UPDATE:

    Sorry that I misunderstood. You can overwrite backend labels with your own xlf files.

    ext_localconf.php

    $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_tca.xlf'][] = 'EXT:your_extension/Resources/Private/Language/yourtranslationfile.xlf';
    

    Resources/Private/Language/yourtranslationfile.xlf

    <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
      <xliff version="1.0">
        <file source-language="en" datatype="plaintext" original="messages" date="2019-11-11T17:23:27Z" product-name="your_extension">
          <header/>
            <body>
              <trans-unit id="sys_category.tabs.category">
                <source>Event properties</source>
              </trans-unit>
            </body>
        </file>
    </xliff>
    

    See translation handling in TYPO3 doc


    Original answer (add a custom tab to page properties):

    You can just add "--div--;Your tab label" to this.

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
      'pages',
      '--div--; My new tab, --palette--;My palette label;eventdetails',
      '1',
      'after:categories'
    );
    

    You don't need (or better you should not) override the categories tab. Actually, this tab won't be displayed, if there are no fields in it (restrict access to categories by access management).