菜单

Getting ready for 4.5: changes in CSH for FlexForms

2011年04月1日 - typo3

If you have designed an extension which uses FlexForms and have added CSH to that form, you need to make a tiny change for TYPO3 4.5. Read on.

The new rendering of CSH in TYPO3 4.5

As you know we try as hard as possible to keep backwards compatibility. Sometimes however it is very desirable to make breaking changes, especially if the secondary effects are not critical.

This is what happened with CSH for FlexForms. Their handling was changed in TYPO3 4.5 to bring it inline with other CSH (for regular tables or BE modules). There’s only a very tiny change that’s necessary. The CSH for the FlexForm must be registered just as with other CSH. Example:

t3lib_extMgm::addLLrefForTCAdescr('somekey', 'EXT:myext/locallang_csh.xml');

The key is defined as follows:

[table name].[field name].[DS pointer field 1](.[DS pointer field 2])

The table and the field are those where the FlexForm is used. In most cases this will be “tt_content.pi_flexform”. The next elements of the key (still separated with dots) are the values of the field or fields (there may be only one) defined in the “ds_pointerField” property for the TCA of the FlexForm field. In the case of plugin options, the “ds_pointerField” property is set to “list_type,CType”, so the key would be of the form:

tt_content.pi_flexform.[value of list_type field].list

“list” being the value of the CType field for a FE plugin. To give a complete example, let’s assume that the plugin used is from the “comments” extension, the full key will be:

tt_content.pi_flexform.comments_pi1.list

because “comments_pi1” is the value found in the field “list_type” when using the plugin provided by the “comments” extension. So the “comments” extension would use the following call to register its FlexForm CSH:

t3lib_extMgm::addLLrefForTCAdescr('tt_content.pi_flexform.comments_pi1.list', 'EXT:comments/pi1/locallang_csh.xml');

With this new method, it is not necessary anymore to point to the CSH file from within the FlexForm’s DS, though the “cshFile” tag should be left for compatibility with older versions of TYPO3.

On top of the above, it is advised (but not required) to use the “alttitle” in the CSH structure intensively, as it will improve the information displayed in the help pop-up window. In particular, don’t forget to define the “general alttitle” which is used at the top of the window. Example:

<label index=".alttitle">My plugin's cool configuration options</label>

Making the changes describe above does not break the compatibility of your extension with older TYPO3 versions. Missing this change only means that the CSH is not displayed anymore, but the extension will still work as expected.

And if you’re not using CSH in the FlexForm of your plugins, this is a good time to start. CSH will greatly improve the usability of your extension.

发表评论

电子邮件地址不会被公开。 必填项已用*标注