mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-01 14:04:30 +02:00
Show additional infos about the part picture, when hovering it.
This commit is contained in:
parent
5248c83982
commit
e19594f500
3 changed files with 78 additions and 3 deletions
27
src/Twig/TypeLabelExtension.php
Normal file
27
src/Twig/TypeLabelExtension.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Twig;
|
||||
|
||||
|
||||
use App\Services\ElementTypeNameGenerator;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
final class TypeLabelExtension extends AbstractExtension
|
||||
{
|
||||
private $nameGenerator;
|
||||
|
||||
public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator)
|
||||
{
|
||||
$this->nameGenerator = $elementTypeNameGenerator;
|
||||
}
|
||||
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new TwigFunction('elementType', [$this->nameGenerator, 'getLocalizedTypeLabel']),
|
||||
new TwigFunction('elementTypeName', [$this->nameGenerator, 'getTypeNameCombination']),
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue