mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-03 06:54:34 +02:00
Added placeholders filter to utilize the placeholders in twig mode
Fixes #546
This commit is contained in:
parent
757201cafa
commit
dff1ef04bf
5 changed files with 83 additions and 3 deletions
|
@ -64,6 +64,7 @@ use App\Twig\BarcodeExtension;
|
|||
use App\Twig\EntityExtension;
|
||||
use App\Twig\FormatExtension;
|
||||
use App\Twig\Sandbox\InheritanceSecurityPolicy;
|
||||
use App\Twig\Sandbox\SandboxedLabelExtension;
|
||||
use App\Twig\TwigCoreExtension;
|
||||
use InvalidArgumentException;
|
||||
use Twig\Environment;
|
||||
|
@ -92,6 +93,9 @@ final class SandboxedTwigFactory
|
|||
|
||||
//FormatExtension:
|
||||
'format_money', 'format_si', 'format_amount', 'format_bytes',
|
||||
|
||||
//SandboxedLabelExtension
|
||||
'placeholders',
|
||||
];
|
||||
|
||||
private const ALLOWED_FUNCTIONS = ['country_names', 'country_timezones', 'currency_names', 'cycle',
|
||||
|
@ -103,7 +107,8 @@ final class SandboxedTwigFactory
|
|||
'entity_type', 'entity_url',
|
||||
//BarcodeExtension:
|
||||
'barcode_svg',
|
||||
|
||||
//SandboxedLabelExtension
|
||||
'placeholder',
|
||||
];
|
||||
|
||||
private const ALLOWED_METHODS = [
|
||||
|
@ -143,6 +148,7 @@ final class SandboxedTwigFactory
|
|||
private readonly BarcodeExtension $barcodeExtension,
|
||||
private readonly EntityExtension $entityExtension,
|
||||
private readonly TwigCoreExtension $twigCoreExtension,
|
||||
private readonly SandboxedLabelExtension $sandboxedLabelExtension,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
@ -172,6 +178,7 @@ final class SandboxedTwigFactory
|
|||
$twig->addExtension($this->barcodeExtension);
|
||||
$twig->addExtension($this->entityExtension);
|
||||
$twig->addExtension($this->twigCoreExtension);
|
||||
$twig->addExtension($this->sandboxedLabelExtension);
|
||||
|
||||
return $twig;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue