mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 06:14:23 +00:00
allow date to be rendered in list/exports
This commit is contained in:
parent
122e54eed6
commit
2042e43613
@ -209,6 +209,15 @@ class CustomFieldDate extends AbstractCustomField
|
|||||||
|
|
||||||
public function render($value, CustomField $customField, $documentType = 'html')
|
public function render($value, CustomField $customField, $documentType = 'html')
|
||||||
{
|
{
|
||||||
|
switch ($documentType) {
|
||||||
|
case 'csv':
|
||||||
|
$date = $this->deserialize($value, $customField);
|
||||||
|
if (NULL === $date) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $date->format('Y-m-d');
|
||||||
|
default:
|
||||||
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:date.'
|
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:date.'
|
||||||
.$documentType.'.twig';
|
.$documentType.'.twig';
|
||||||
|
|
||||||
@ -218,6 +227,7 @@ class CustomFieldDate extends AbstractCustomField
|
|||||||
'format' => $customField->getOptions()[self::FORMAT]
|
'format' => $customField->getOptions()[self::FORMAT]
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function serialize($date, CustomField $customField)
|
public function serialize($date, CustomField $customField)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user