Feature #21204

Question about class.t3lib_tceforms.php

Added by Stefan Froemken over 11 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-10-08
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

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)

#1

Updated by Alexander Opitz almost 8 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)

The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?

#2

Updated by Stefan Froemken almost 8 years ago

Oh dear. A little bit dusty here :-)
The problem is still there and exists in 4.5 and 6.1, too. The basic of this problem is much more understandable in case of extbase:

settings.category.view = 15

Please add a relation to this ticket:
http://forge.typo3.org/issues/40674

Stefan

#3

Updated by Alexander Opitz almost 8 years ago

Why it is related to #40674? Which is Rejected.

#4

Updated by Stefan Froemken almost 8 years ago

TYPO3 has problems with multiple dots in one property. So there is no problem with:

TCEFORM.tt_content.date.config. size = 40

But in case of subproperties TYPO3 was confused:

TCEFORM.tt_content.date.config. date.format = d.m.Y

or in case of extbase:

TCEFORM.tt_content.pi_flexform.[Flexconfig]. settings.field1 .format = d.m.Y

Here you can see: "settings.field1" has to be interpreted by TYPO3 as ONE field. But the dot in between makes the difference. I'm not sure, but in my opinion it was really hard to solve this. Maybe this is why the related ticked was rejected.

Stefan

#5

Updated by Alexander Opitz over 7 years ago

  • Is Regression set to No

Update description for better viewing

#6

Updated by Alexander Opitz over 7 years ago

  • Tracker changed from Bug to Feature
  • Status changed from Needs Feedback to New

Verified.

BTW: The "After array"

(
    [config] => Array
        (
            [format] => Array
                (
                    [option] => d.m.Y
                )

            [readOnly] => 1
        )
)

gets later overwritten into

array (
  'type' => 'input',
  'size' => '13',
  'max' => '20',
  'eval' => 'date',
  'default' => '0',
  'form_type' => 'input',
  'readOnly' => '1',
  'checkbox' => '0',
  'format' => 'date',
)

Maybe that's why overwriting the format isn't allowed, Maybe it is a missing feature but not a bug as it is a problem after changing the source.

#7

Updated by Daniel Goerz almost 6 years ago

I think this issue could be closed, since the following pageTSConfig works just fine now:

TCEFORM.tt_content.date.config.format = d-M-Y
TCEFORM.tt_content.date.config.readOnly = 1

You can successfully change the format and readOnly behavior of the Date column in tt_content. And if I read this correctly that is all the authors couldn't acheive earlier.

#8

Updated by Daniel Goerz almost 6 years ago

  • Status changed from New to Closed

In accordance with Stefan this is no longer an issue.

Also available in: Atom PDF