- Issue created by @pdureau
- Merge request !38Issue #3481067 by pdureau: Make twig function more tolerant → (Merged) created by pdureau
Automatically closed - issue fixed for 2 weeks with no activity.
icon()
Twig function expects valid values for icon_pack & icon:
public function getIconRenderable(string $icon_pack_id, string $icon_id, ?array $settings = []): array {
So, we need to always wrap the function around a test:
{% if icon %}
{{ icon(icon.icon_pack, icon.icon, icon.settings) %}
{% endif %}
Move the test to the Twig function itself so we don't need to add it in the template.
Non tested proposal:
public function getIconRenderable(?string $icon_pack_id, ?string $icon_id, ?array $settings = []): array {
if (!$icon_pack_id || !$icon_id) {
return [];
}
Active
1.0
Code
Automatically closed - issue fixed for 2 weeks with no activity.