mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
PORT PHRAS-854 to 4.1
This commit is contained in:
@@ -143,6 +143,25 @@ class TwigServiceProvider implements ServiceProviderInterface
|
||||
$twig->addFilter(new \Twig_SimpleFilter('escapeDoubleQuote', function ($value) {
|
||||
return str_replace('"', '\"', $value);
|
||||
}));
|
||||
|
||||
$twig->addFilter(new \Twig_SimpleFilter('formatDuration',
|
||||
function ($secondsInDecimals) {
|
||||
$time = [];
|
||||
$hours = floor($secondsInDecimals / 3600);
|
||||
$secondsInDecimals -= $hours * 3600;
|
||||
$minutes = floor($secondsInDecimals / 60);
|
||||
$secondsInDecimals -= $minutes * 60;
|
||||
$seconds = intVal($secondsInDecimals % 60, 10);
|
||||
if ($hours > 0) {
|
||||
array_push($time, (strlen($hours) < 2) ? "0{$hours}" : $hours);
|
||||
}
|
||||
array_push($time, (strlen($minutes) < 2) ? "0{$minutes}" : $minutes);
|
||||
array_push($time, (strlen($seconds) < 2) ? "0{$seconds}" : $seconds);
|
||||
$formattedTime = implode(':', $time);
|
||||
|
||||
return $formattedTime;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -62,7 +62,7 @@ class ElasticsearchRecordHydrator
|
||||
$record->setTitles((array) igorw\get_in($data, ['title'], []));
|
||||
$record->setCaption((array) igorw\get_in($data, ['caption'], []));
|
||||
$record->setPrivateCaption((array) igorw\get_in($data, ['private_caption'], []));
|
||||
$record->setExif((array) igorw\get_in($data, ['exif'], []));
|
||||
$record->setExif((array)igorw\get_in($data, ['metadata_tags'], []));
|
||||
$record->setSubdefs((array) igorw\get_in($data, ['subdefs'], []));
|
||||
$record->setFlags((array) igorw\get_in($data, ['flags'], []));
|
||||
$record->setHighlight((array) $highlight);
|
||||
|
Reference in New Issue
Block a user