Actions
Bug #59245
closedPAGE_TSCONFIG_ID is not visible in TCA wizards
Status:
Closed
Priority:
Should have
Assignee:
Category:
FormEngine aka TCEforms
Target version:
Start date:
2014-05-31
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Description
Reported by Steffen Kamper in Core ML:
Hi,
with the wish of organizing related records in the BE i stumbled on this kind of configuration:
'competition' => array( 'exclude' => 0, 'label' => 'LLL:EXT:ceb_dates/locallang_db.xml:tx_cebdates_dates.competition', 'config' => array( 'type' => 'select', 'foreign_table' => 'tx_ceb_competition', 'foreign_table_where' => ' AND tx_ceb_competition.pid = ###PAGE_TSCONFIG_ID### ORDER BY tx_ceb_competition.uid', 'size' => 1, 'minitems' => 0, 'maxitems' => 1, 'wizards' => array( '_PADDING' => 2, '_VERTICAL' => 1, 'add' => array( 'type' => 'script', 'title' => 'Create new record', 'icon' => 'add.gif', 'params' => array( 'table' => 'tx_ceb_competition', 'pid' => '###PAGE_TSCONFIG_ID###', 'setValue' => 'prepend' ), 'script' => 'wizard_add.php', ), ), ) ),
Though the variable ###PAGE_TSCONFIG_ID###
is replaced correctly in the where part of selecting records, it doesn't work with adding new records with the wizard.
Looking to the code, i found the reason:
if (substr($this->P['params']['pid'],0,3)=='###' && substr($this->P['params']['pid'],-3)=='###') {
$this->pid = intval($TSconfig['_'.substr($this->P['params']['pid'],3,-3)]);
where only available vars here are CURRENT_PID
, STORAGE_PID
and SITEROOT
, though documentation promises more.
I was able to fix it by inserting this small logic:
// Set [params][pid]
if (substr($this->P['params']['pid'],0,3)=='###' && substr($this->P['params']['pid'],-3)=='###') {
$keyword = substr($this->P['params']['pid'], 3, -3);
if (substr($keyword, 0, 14) == 'PAGE_TSCONFIG_') {
$this->pid = intval($TSconfig[$this->P['field']][$keyword]);
} else {
$this->pid = intval($TSconfig['_' . $keyword]);
}
} else $this->pid = intval($this->P['params']['pid']);
Maybe someone wants to pick it up for integration.
Thanks.
Actions