Project

General

Profile

Actions

Bug #59245

closed

PAGE_TSCONFIG_ID is not visible in TCA wizards

Added by Xavier Perseguers about 10 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
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 #1

Updated by Gerrit Code Review about 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

Actions #2

Updated by Gerrit Code Review about 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

Actions #3

Updated by Xavier Perseguers about 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
}
Actions #4

Updated by Gerrit Code Review about 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

Actions #5

Updated by Gerrit Code Review about 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

Actions #6

Updated by Steffen Kamper about 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #7

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF