{# Plugin Configuration Partial - Server-side rendered form #} {# This template is loaded via HTMX when a plugin tab is clicked #} {# ===== MACROS FOR FORM FIELD GENERATION ===== #} {# Render a single form field based on schema type #} {% macro render_field(key, prop, value, prefix='', plugin_id='') %} {% set full_key = (prefix ~ '.' ~ key) if prefix else key %} {% set field_id = (plugin_id ~ '-' ~ full_key)|replace('.', '-')|replace('_', '-') %} {% set label = prop.title if prop.title else key|replace('_', ' ')|title %} {% set description = prop.description if prop.description else '' %} {% set field_type = prop.type if prop.type is string else (prop.type[0] if prop.type is iterable else 'string') %} {# Handle nested objects recursively #} {% if field_type == 'object' and prop.properties %} {{ render_nested_section(key, prop, value, prefix, plugin_id) }} {% else %}
{{ description }}
{% endif %} {# Boolean checkbox #} {% if field_type == 'boolean' %} {# Enum dropdown #} {% elif prop.enum %} {# Number input #} {% elif field_type in ['number', 'integer'] %} {# Array of strings (comma-separated) #} {% elif field_type == 'array' %} {% set array_value = value if value is not none else (prop.default if prop.default is defined else []) %}Separate multiple values with commas
{# Text input (default) #} {% else %} {% endif %}{{ plugin.description or 'Plugin configuration' }}