How to add Tooltips to a Flexform Plugin Configuration?

天涯浪子 提交于 2019-12-05 11:32:19

It's quite easy... but caching of TYPO3 6.2 can be dramatically annoying in this case

  1. Let's say that you have an extension with key my_extension and Bar plugin, the common flexform inclusion in ext_tables.php looks like:

    $pluginSignature = str_replace('_','',$_EXTKEY) . '_bar'; // which gives `myextension_bar`
    $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_bar.xml');
    
  2. Create file for CSH for an example (name doesn't matter, anyway by convention...):

    typo3conf/ext/my_extension/Resources/Private/Language/locallang_csh_flexform_bar.xlf
    
  3. Add a reference to this locallang in ext_tables.php with proper (!) key

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
        'tt_content.pi_flexform.myextension_bar.list',
        'EXT:my_extension/Resources/Private/Language/locallang_csh_flexform_bar.xlf'
    );
    
  4. MOST IMPORTANT open Install Tool, go to Important actions and click Clear all cache

  5. That's all: your CSH should work now, if it doesn't check if key of locallang (tt_content.pi_flexform...) is valid, also check in Configuration > $GLOBALS['TCA_DESCR'] if it's listed there (if not clear cache form Install tool again)

Sample locallang_csh_flexform_bar.xlf:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
    <file source-language="en" datatype="plaintext" original="messages" date="2014-05-28T07:44:03Z" product-name="my_extension">
        <header/>
        <body>
            <trans-unit id="settings.disqus.sso.name.description">
                <source>Your site's name. Disqus will display it in the Post As window.</source>
            </trans-unit>
        </body>
    </file>
</xliff>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!