mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-16 02:09:44 +00:00
allow date to be rendered in list/exports
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user