Files
kupshop/bundles/KupShop/ArticlesBundle/Twig/Components/Articles/Labels.php
2025-08-02 16:30:27 +02:00

46 lines
1.1 KiB
PHP

<?php
namespace KupShop\ArticlesBundle\Twig\Components\Articles;
use KupShop\ArticlesBundle\Twig\Components\Articles\Utils\ArticleTrait;
use KupShop\ComponentsBundle\Attributes\Component;
use KupShop\ComponentsBundle\Attributes\Version;
use KupShop\ComponentsBundle\Twig\BaseComponent;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
#[AsTwigComponent(template: '@Articles/components/Articles/Labels/Labels.1.html.twig')]
#[Component(1, [
new Version(1, newJs: null),
])]
class Labels extends BaseComponent
{
use ArticleTrait;
private ?array $tags = null;
public ?string $title = null;
public function getTags(): ?array
{
if (!$this->tags) {
return $this->tags = $this->articlesUtil->getArticleTags(null, 1);
}
return $this->tags;
}
public function getUrl($id, $title, $type, $idKey = 'ID', $absolute = null): string
{
$params = [
's' => $type,
$idKey => $id,
'TITLE' => $title,
];
if ($absolute) {
$params['absolute'] = 1;
}
return htmlspecialchars(createScriptURL($params), ENT_QUOTES);
}
}