{% extends 'forms/base_widget.html' %}


{% block html %}
    <input type="hidden" id="{{ field.id }}" name="{{ field.name }}" value="{{ field._value() }}"
           {{ input_args | html_params }}>
    <div id="principalField-{{ field.id }}"></div>
{% endblock %}


{% block javascript %}
    <script>
        setupPrincipalWidget({
            fieldId: {{ field.id | tojson }},
            required: {{ input_args.required | default(false) | tojson }},
            withExternalUsers: {{ field.allow_external_users | tojson }},
            disabled: {{ (field.render_kw.disabled if field.render_kw else false) | tojson }},
            searchToken: {{ field.search_token | tojson }},
        });
    </script>
{% endblock %}
