Show additional infos about the part picture, when hovering it.

This commit is contained in:
Jan Böhmer 2020-05-27 22:51:43 +02:00
parent 5248c83982
commit e19594f500
3 changed files with 78 additions and 3 deletions

View 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']),
];
}
}