[TYPO3-v4] Broken CSH in FlexForms with current trunk
François Suter
fsu-lists at cobweb.ch
Fri Dec 31 22:12:16 CET 2010
Hi all,
Recently a new API was introduced in 4.5 to generate the new help
bubbles. Some parts of the UI were forgotten and in particular the
FlexForms. Although rarely used it is possible to have CSH in FlexForms
since 4.2.
I have looked at the issue [1] but it's not easy because CSH is not
handled the same way in FlexForms as in the rest of the BE. I'm not sure
why, but I guess this was due to the difficulty of finding explicit,
unique keys for registering the reference to the CSH file as is done
with tables or BE modules. Indeed the FlexForms themselves contain the
reference to the CSH file, as can be seen here in an excerpt from the
"comments" extensions:
<T3DataStructure>
<meta>
<langDisable>1</langDisable>
<langChildren>0</langChildren>
</meta>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:comments/pi1/locallang.xml:sheet.advanced</sheetTitle>
<cshFile>LLL:EXT:comments/pi1/locallang_csh.xml</cshFile>
</TCEforms>
[snip]
</ROOT>
</T3DataStructure>
and the file is not registered globally using
t3lib_extMgm::addLLrefForTCAdescr(). Instead it is read when the
FlexForm itself is rendered (see
t3lib_TCEforms::helpTextIcon_typeFlex()). A further complication is that
the link on the "read more" icon needs to contain all the additional
data to display, since typo3/view_help.php cannot refer to any file
directly (since it is not registered in $TCA_DESCR). This is achieved by
reading all relevant strings and passing them in the URL with base64
encoding, which I find an ugly hack.
Given the hacky nature of the current implementation and the fact that
it implies having a double system for rendering CSH, I would like not
just to fix the issue, but to change the way CSH is handled in
FlexForms. I think it's possible to define unique keys, that can be
rebuilt dynamically by TCEforms when needed. I'm thinking of using the
table name, the FlexForm field name and the value(s) referred to by the
"ds_pointerField" property. For example, for the comment extension, the
key would be:
tt_content.pi_flexform.plugin.comments_pi1
Such a key can perfectly be rebuilt from within
t3lib_TCEforms::getSingleField_typeFlex_draw() as all the necessary
information is available. The CSH file itself would be registered as is
usual, with the above-mentioned key, i.e.
t3lib_extMgm::addLLrefForTCAdescr('tt_content.pi_flexform.plugin.comments_pi1',
'EXT:comments/pi1/locallang_csh.xml');
Given all that, the CSH could be rendered in FlexForms using
t3lib_BEfunc::wrapInHelp() as all others and a simple key could also be
passed to typo3/view_help.php.
The obvious disadvantage is that this represents a breaking change,
FlexForm CSH for existing extensions would not work anymore. Personally
I think that the above-mentioned advantages outweigh this disadvantage
because:
1) we will have a much healthier situation
2) as mentioned before, very few extensions make use of this feature
(which we could actually publicize)
3) CSH is not critical to the functioning of an extension, so nothing is
really broken. If we advertize the change, extension developers can be
ready in time, it would be a simple change for them.
I'll be away next week on holidays, I'm looking forward to reading your
feedback upon my return.
Signing off for 2010 :-)
--
Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch
[1] http://bugs.typo3.org/view.php?id=16848
More information about the TYPO3-project-v4
mailing list