mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +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')
|
public function render($value, CustomField $customField, $documentType = 'html')
|
||||||
{
|
{
|
||||||
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:date.'
|
switch ($documentType) {
|
||||||
.$documentType.'.twig';
|
case 'csv':
|
||||||
|
$date = $this->deserialize($value, $customField);
|
||||||
return $this->templating
|
if (NULL === $date) {
|
||||||
->render($template, array(
|
return null;
|
||||||
'value' => $this->deserialize($value, $customField),
|
}
|
||||||
'format' => $customField->getOptions()[self::FORMAT]
|
|
||||||
));
|
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)
|
public function serialize($date, CustomField $customField)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user