#21204Question about class.t3lib_tceforms.php
Description
First of all: Following is only a try.
I only want to show a date in format “d.m.Y”.
On line 844 I found this one:
$PA[‘fieldConf’][‘config’] = $this->overrideFieldConf($PA[‘fieldConf’][‘config’], $PA[‘fieldTSConfig’]);
This function puts all allowed attibutes from PageTS into $PA[‘fieldConf’][‘config’].
To allow this special format I have to add two more attributes
Line ~351 in function t3lib_TCEforms:
$this->allowOverrideMatrix = array(
'input' => array('size', 'max', 'format', 'readOnly'),
There is only a call to formatValue, if the field is readOnly. So this has to be set, too.
But in function overrideFieldConf there is a call to removeDotsFromTS:
Line ~3200 in function overrideFieldConf:
print("Before");
print_r($TSconfig);
$TSconfig = t3lib_div::removeDotsFromTS($TSconfig);
print("After");
print_r($TSconfig);
This causes a mistake in function formatValue:
Line ~2920 in function formatValue:
switch($format) {
case 'date':
if ($itemValue) {
print_r($config);
$option = trim($config['format.']['option']);
if ($option) {
I insert folloeing lines into PageTS:
TCEFORM.tt_content.date.config.format = date
TCEFORM.tt_content.date.config.format.option = d.m.Y
TCEFORM.tt_content.date.config.readOnly = 1
I change class.t3lib_tceforms.php to allow overriding the values “format” and “readOnly” (see description).
My print_r told me this:
BeforeArray
(
[config.] => Array
(
[format] => date
[format.] => Array
(
[option] => d.m.Y
)
[readOnly] => 1
)
)
AfterArray
(
[config] => Array
(
[format] => Array
(
[option] => d.m.Y
)
[readOnly] => 1
)
)
You see: Format => date is gone away.
So there is a problem with:
$TSconfig = t3lib_div::removeDotsFromTS($TSconfig);
it removes too much.
IMHO the row:
$value = date($option,$itemValue); LINE ~2932
can’t be reached.
Let me know if I’m wrong
(issue imported from #M12148)
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.