Bug #59245
closedPAGE_TSCONFIG_ID is not visible in TCA wizards
100%
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.
Updated by Gerrit Code Review over 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30498
Updated by Gerrit Code Review over 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30498
Updated by Xavier Perseguers over 10 years ago
This variable should be set in pageTS:
TCEFORM.tx_mytable.myfield { PAGE_TSCONFIG_ID = 123 }
thus in this example:
TCEFORM.tx_cebdates_dates.competition { PAGE_TSCONFIG_ID = 123 }
Updated by Gerrit Code Review over 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30498
Updated by Gerrit Code Review over 10 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30498
Updated by Steffen Kamper over 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 14183c8d0dfbb85110e99de786b964ddf01fb221.