Allow to associate settings forms with info providers

This commit is contained in:
Jan Böhmer 2025-08-24 23:32:58 +02:00
parent eaaf44b391
commit ee33d743e6
7 changed files with 100 additions and 13 deletions

View file

@ -13,7 +13,6 @@
{% else %}
{{ provider.providerInfo.name | trans }}
{% endif %}
</h5>
<div>
{% if provider.providerInfo.description is defined and provider.providerInfo.description is not null %}
@ -23,6 +22,11 @@
</div>
<div class="col-6">
{% if provider.providerInfo.settings_class is defined %}
<a href="{{ path('info_providers_provider_settings', {'provider': provider.providerKey}) }}" class="btn btn-primary btn-sm"
title="{% trans %}info_providers.settings.title{% endtrans %}"
><i class="fa-solid fa-cog"></i></a>
{% endif %}
{% for capability in provider.capabilities %}
{# @var capability \App\Services\InfoProviderSystem\Providers\ProviderCapabilities #}
<span class="badge text-bg-secondary">
@ -52,4 +56,4 @@
{% endfor %}
</tbody>
</table>
{% endmacro %}
{% endmacro %}

View file

@ -0,0 +1,27 @@
{% extends "main_card.html.twig" %}
{% macro genId(widget) %}{{ widget.vars.full_name }}{% endmacro %}
{% form_theme form "form/settings_form.html.twig" %}
{% block title %}{% trans %}info_providers.settings.title{% endtrans %}: {{ info_provider_info.name }}{% endblock %}
{% block card_title %}<i class="fa-solid fa-gear fa-fw"></i> {% trans %}info_providers.settings.title{% endtrans %}: <b>{{ info_provider_info.name }}</b>{% endblock %}
{% block card_content %}
<div class="offset-sm-3">
<h3>
{% if info_provider_info.url %}
<a href="{{ info_provider_info.url }}" class="link-external" target="_blank" rel="nofollow">{{ info_provider_info.name }}</a>
{% else %}
{{ info_provider_info.name }}
{% endif %}
</h3>
{% if info_provider_info.description %}
<p class="text-muted">{{ info_provider_info.description }}</p>
{% endif %}
</div>
{{ form_start(form) }}
{{ form_help(form) }}
{{ form_end(form) }}
{% endblock %}