Show the diff of element edited log entries on detail pages

This commit is contained in:
Jan Böhmer 2023-05-14 23:08:14 +02:00
parent 923e40ed8f
commit b62fd602f2
8 changed files with 369 additions and 11 deletions

View file

@ -21,20 +21,27 @@
namespace App\Twig;
use App\Services\LogSystem\LogDataFormatter;
use App\Services\LogSystem\LogDiffFormatter;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class LogExtension extends AbstractExtension
final class LogExtension extends AbstractExtension
{
public function __construct(LogDataFormatter $logDataFormatter)
private LogDataFormatter $logDataFormatter;
private LogDiffFormatter $logDiffFormatter;
public function __construct(LogDataFormatter $logDataFormatter, LogDiffFormatter $logDiffFormatter)
{
$this->logDataFormatter = $logDataFormatter;
$this->logDiffFormatter = $logDiffFormatter;
}
public function getFunctions()
{
return [
new TwigFunction('format_log_data', [$this->logDataFormatter, 'formatData'], ['is_safe' => ['html']])
new TwigFunction('format_log_data', [$this->logDataFormatter, 'formatData'], ['is_safe' => ['html']]),
new TwigFunction('format_log_diff', [$this->logDiffFormatter, 'formatDiff'], ['is_safe' => ['html']]),
];
}
}