TYPO3CMS
9.5
Main Page
Related Pages
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
DatabaseRowDateTimeFields.php
Go to the documentation of this file.
1
<?php
2
namespace
TYPO3\CMS\Backend\Form\FormDataProvider
;
3
4
/*
5
* This file is part of the TYPO3 CMS project.
6
*
7
* It is free software; you can redistribute it and/or modify it under
8
* the terms of the GNU General Public License, either version 2
9
* of the License, or any later version.
10
*
11
* For the full copyright and license information, please read the
12
* LICENSE.txt file that was distributed with this source code.
13
*
14
* The TYPO3 project - inspiring people to share!
15
*/
16
17
use
TYPO3\CMS\Backend\Form\FormDataProviderInterface
;
18
use
TYPO3\CMS\Core\Database\Query\QueryHelper
;
19
23
class
DatabaseRowDateTimeFields
implements
FormDataProviderInterface
24
{
31
public
function
addData
(array $result)
32
{
33
$dateTimeTypes =
QueryHelper::getDateTimeTypes
();
34
$dateTimeFormats =
QueryHelper::getDateTimeFormats
();
35
36
foreach
($result[
'processedTca'
][
'columns'
] as $column => $columnConfig) {
37
if
(isset($columnConfig[
'config'
][
'dbType'
])
38
&& in_array($columnConfig[
'config'
][
'dbType'
], $dateTimeTypes,
true
)
39
) {
40
if
(!empty($result[
'databaseRow'
][$column])
41
&& $result[
'databaseRow'
][$column] !== $dateTimeFormats[$columnConfig[
'config'
][
'dbType'
]][
'empty'
]
42
) {
43
// Create an ISO-8601 date from current field data; the database always contains UTC
44
// The field value is something like "2016-01-01" or "2016-01-01 10:11:12", so appending "UTC"
45
// makes date() treat it as a UTC date (which is what we store in the database).
46
$result[
'databaseRow'
][$column] = date(
'c'
, strtotime($result[
'databaseRow'
][$column] .
' UTC'
));
47
}
else
{
48
$result[
'databaseRow'
][$column] =
null
;
49
}
50
}
51
// its a UNIX timestamp! We do not modify this here, as it will only be treated as a datetime because
52
// of eval being set to "date" or "datetime". This is handled in InputTextElement then.
53
}
54
return
$result;
55
}
56
}
TYPO3\CMS\Core\Database\Query\QueryHelper\getDateTimeFormats
static array getDateTimeFormats()
Definition:
QueryHelper.php:175
TYPO3\CMS\Core\Database\Query\QueryHelper
Definition:
QueryHelper.php:30
TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowDateTimeFields
Definition:
DatabaseRowDateTimeFields.php:24
TYPO3\CMS\Core\Database\Query\QueryHelper\getDateTimeTypes
static array getDateTimeTypes()
Definition:
QueryHelper.php:200
TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowDateTimeFields\addData
array addData(array $result)
Definition:
DatabaseRowDateTimeFields.php:31
TYPO3\CMS\Backend\Form\FormDataProvider
Definition:
AbstractDatabaseRecordProvider.php:2
TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition:
FormDataProviderInterface.php:22
doxygen
typo3
sysext
backend
Classes
Form
FormDataProvider
DatabaseRowDateTimeFields.php
Generated on Tue Oct 5 2021 01:56:54 for TYPO3CMS by
1.8.18