mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
allow date to be rendered in list/exports
This commit is contained in:
parent
122e54eed6
commit
2042e43613
@ -209,14 +209,24 @@ class CustomFieldDate extends AbstractCustomField
|
||||
|
||||
public function render($value, CustomField $customField, $documentType = 'html')
|
||||
{
|
||||
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:date.'
|
||||
.$documentType.'.twig';
|
||||
|
||||
return $this->templating
|
||||
->render($template, array(
|
||||
'value' => $this->deserialize($value, $customField),
|
||||
'format' => $customField->getOptions()[self::FORMAT]
|
||||
));
|
||||
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.'
|
||||
.$documentType.'.twig';
|
||||
|
||||
return $this->templating
|
||||
->render($template, array(
|
||||
'value' => $this->deserialize($value, $customField),
|
||||
'format' => $customField->getOptions()[self::FORMAT]
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public function serialize($date, CustomField $customField)
|
||||
|
Loading…
x
Reference in New Issue
Block a user