{% extends request.ajax ? 'layout_blank.html.twig' : 'layout_default.html.twig' %}

{% import 'macro_functions.html.twig' as mf %}

{% block meta_title %}{{ 'Settings'|trans }}{% endblock %}

{% set active_menu = 'system' %}
{% set params = admin.system_get_params %}

{% block content %}
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">Settings</h3>
        </div>
        <div class="card-body">
            <div class="datagrid">
                {% for ext in admin.extension_get_list({ 'active': 1, 'has_settings': 1 }|merge(request)) %}
                    <div class="datagrid-item">
                        <div class="datagrid-title">
                            <a href="{{ 'extension/settings'|alink }}/{{ ext.id }}">
                                {% set icon_filename = ext.icon_url|split('/')|last %}
                                {% if (icon_filename != 'cog.svg') and (icon_filename|split('.')|last == 'svg' and ext.icon_path) %}
                                    <div class="d-flex align-items-center gap-2">
                                        <div class="text-primary" style="width:24px;height:24px;">
                                            {{ source (ext.icon_path, ignore_missing = true) }}
                                        </div>
                                        <span>{{ ext.name }}</span>
                                    </div>
                                {% else %}
                                    <div class="d-flex align-items-center gap-2">
                                        <img src="{{ ext.icon_url }}" alt="{{ ext.name }}" style="width:32px;height:32px;">
                                        <span>{{ ext.name }}</span>
                                    </div>
                                {% endif %}
                            </a>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </div>
    </div>
{% endblock %}
