[TYPO3-dev] Problem with FlexFrom field of type select
Stephen Bungert
stephenbungert at yahoo.de
Mon Sep 26 17:01:16 CEST 2011
Hello,
I have a problem with the rendering of a select field in my extensions
plugin flexform.
Here is the xml for the field in the flexform ds:
<category>
<TCEforms>
<label>LLL:EXT:sb_portfolio/pi1/flexform_locallang.xml:itemSelection.category</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex
index="0">LLL:EXT:sb_portfolio/pi1/flexform_locallang.xml:itemSelection.category.0</numIndex>
<numIndex index="1">-1</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex
index="0">LLL:EXT:sb_portfolio/pi1/flexform_locallang.xml:itemSelection.category.1</numIndex>
<numIndex index="1">--div--</numIndex>
</numIndex>
</items>
<exclusiveKeys>-1</exclusiveKeys>
<foreign_table_where> AND tx_sbportfolio_categories.pid IN
(###STORAGE_PID###, ###PAGE_TSCONFIG_IDLIST###) AND
(tx_sbportfolio_categories.sys_language_uid=0 ||
(tx_sbportfolio_categories.sys_language_uid>0 AND
tx_sbportfolio_categories.l10n_parent=0)) ORDER BY
tx_sbportfolio_categories.title ASC</foreign_table_where>
<foreign_table>tx_sbportfolio_categories</foreign_table>
<size>6</size>
<autoSizeMax>12</autoSizeMax>
<minitems>0</minitems>
<maxitems>500</maxitems>
</config>
</TCEforms>
</category>
In the rendered form the right hand part of the select field lists all the
records it finds in ###STORAGE_PID### and the ###PAGE_TSCONFIG_IDLIST###
(taken from TCEFORM.tt_content.pi_flexform.PAGE_TSCONFIG_IDLIST) ,
The problem is the left hand part of the form that shows the records that
have been selected from the list on the right.
Any records that are stored in the pids set in ###PAGE_TSCONFIG_IDLIST###
are not displayed. They exist in the database in the flexform data saved in
the tt_content record, but are lost in the function: "selectAddForeign" in
"class.t3lib_transferdata.php".
I have found the cause of the problem, the $field argument passed to the
function selectAddForeign is empty,
therefore the ###PAGE_TSCONFIG_IDLIST### can't be replaced when
exec_foreign_table_where_query is called as the str_replace function used in
that function requires the $field value to be set, see below:
...
$fTWHERE = str_replace('###PAGE_TSCONFIG_ID###',
intval($TSconfig[$field]['PAGE_TSCONFIG_ID']), $fTWHERE)
...
therefore it can't replace the ###PAGE_TSCONFIG_IDLIST### with the correct
PIDs to look in.
Because of this, the left hand field never shows the selected records even
though they are saved in the database and are shown in the righthand part of
the select field - I have checked this and $field is set when the right hand
part of the select field is populated.
Why is $field not set for the left hand side part of the select field, but
set for the right when it gets populated with record titles?
Can this be fixed? Or some kind of hook added to the function
selectAddForeign() in class.t3lib_transferdata.php so that I can fix this
problem with a function of my own to process the records?
Thanks for any help.
Stephen
More information about the TYPO3-dev
mailing list