[TYPO3-core] RFC #16848: Bug: CSH in FlexForms does not work anymore

François Suter fsu-lists at cobweb.ch
Fri Jan 14 13:26:01 CET 2011


This is an SVN patch request.

Type: Bugfix (and a bit more)

Bugtracker references:
http://bugs.typo3.org/view.php?id=16848

Branches:
Trunk

Problem:
Since the new CSH API was introduced, the CSH in FlexForms doesn't work 
properly anymore.

Test scenario:
Install extension "comments" from the TER, create an instance of its 
plugin and see that CSH in the Plugin options does not display properly.

Solution:
Use the new API (but see the Notes below ;-) )

Notes:
1) As I started looking into this issue, I realised that CSH support in 
FlexForms had been implemented in a rather "hacky" way. CSH file 
reference was read from the FlexForm structure and loaded on demand. 
This caused issue with the help pop-up (typo3/view_help.php) which 
couldn't know about the CSH. So all the CSH information required for the 
field was passed to the pop-up window as a base64 encoded array.

I think this is an opportunity to set this straight, so this patch also 
implies corrections to typo3/view_help.php.

The new process requires for the FlexForm CSH files to be loaded as any 
other. So in order to test the patch, edit the comments extension's 
ext_tables.php file and add the following:

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

This shows the required syntax for the CSH key (first argument of the 
method):

"table name"."field name".(values from keys defined in the 
ds_pointerField property)

For the standard "pi_flexform" field, the "ds_pointerField" property is 
set to "list_type,CType" which converts to (in this particular case) 
"comments_pi1.list".

Using the information from the "ds_pointerField" property makes it 
possible to refer to the correct CSH file unambiguously from within 
TCEforms.

After that the CSH is used as usual, I changed the code so that it's all 
transparent from then on. Leaving the reference to the CSH inside the 
FlexForm ensures that the extension is still compatible with older 
versions. The only real drawback is that CSH for FlexForms will not be 
displayed in 4.5 until the developer adds the proper calls to 
t3lib_extMgm::addLLrefForTCAdescr(). I think this little break in 
compatibility is ok, since it is easily patched, it breaks nothing 
critical and has no impact on older versions.

2) There's one small additional limitation, which could be lifted, but I 
wanted your opinion first to know if it's worth it. In the CSH any table 
or field can have an "alttile". If it doesn't and it's a table field, 
typo3/view_help.php will fall back on the label from the TCA. For 
FlexForm fiels, this would required to load the FlexForm definition and 
get the label from there. My opinion is that this requires more work 
than it's really worth, so it would force people to use "alttitle"s in 
FlexForm CSH in order to have a human-readable name for a field, which 
makes it a double work with what is already entered in the FlexForm's 
definition. What do you think? Is that an acceptable requirement or 
should we make the effort to get the info from the FlexForm definition?

3) I did quite a bit of cleanup in typo3/view_help.php in the methods 
that I was touching upon anyway. This makes the patch a bit harder to 
read, but it was a mess to separate the two.

Cheers

-- 
Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 16848.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20110114/de3d5e42/attachment.asc>


More information about the TYPO3-team-core mailing list