GenericTable: remove unused formatting types

This commit is contained in:
Aaron van Geffen 2025-01-08 18:32:24 +01:00
parent 9740416cb2
commit 7c25d628e1

View File

@ -217,31 +217,9 @@ class GenericTable
private function processFormatting($options, $rowData) private function processFormatting($options, $rowData)
{ {
if (!isset($options['type']))
$options['type'] = 'value';
// Parse the basic value first. // Parse the basic value first.
switch ($options['type']) switch ($options['type'])
{ {
// Basic option: simply take a use a particular data property.
case 'value':
$value = htmlspecialchars($rowData[$options['data']] ?? '');
break;
// Processing via a lambda function.
case 'function':
$value = $options['data']($rowData);
break;
// Using sprintf to fill out a particular pattern.
case 'sprintf':
$parameters = [$options['data']['pattern']];
foreach ($options['data']['arguments'] as $identifier)
$parameters[] = $rowData[$identifier];
$value = sprintf(...$parameters);
break;
// Timestamps get custom treatment. // Timestamps get custom treatment.
case 'timestamp': case 'timestamp':
if (empty($options['data']['pattern']) || $options['data']['pattern'] === 'long') if (empty($options['data']['pattern']) || $options['data']['pattern'] === 'long')