Project

General

Profile

Actions

Feature #21204

closed

Question about class.t3lib_tceforms.php

Added by Stefan Froemken about 15 years ago. Updated over 9 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)

Actions

Also available in: Atom PDF