{% macro controller(form, deleteMessage, rowsToDelete) %}
    {% if form.vars.prototype is defined %}
        {{ stimulus_controller('elements/collection_type', {
            'deleteMessage': deleteMessage|trans,
            'prototype': form_widget(form.vars.prototype)|e('html_attr'),
            'rowsToDelete': rowsToDelete,
            'fieldPlaceholder': form.vars.prototype_name
        }) }}
    {% else %} {# If add_element is disabled/forbidden, prototype is not available #}
        {{ stimulus_controller('elements/collection_type', {
            'deleteMessage': deleteMessage|trans,
            'rowsToDelete': rowsToDelete,
            'fieldPlaceholder': form.vars.prototype_name
        }) }}
    {% endif %}
{% endmacro %}

{% macro target() %}
    {{ stimulus_target('elements/collection_type', 'target') }}
{% endmacro %}

{% macro create_btn() %}
    {{ stimulus_action('elements/collection_type', 'createElement') }}
{% endmacro %}

{% macro create_pricedetail_btn() %}
    {{ stimulus_action('elements/collection_type', 'createPricedetail') }}
{% endmacro %}

{% macro delete_btn() %}
    {{ stimulus_action('elements/collection_type', 'deleteElement') }}
{% endmacro %}

{% macro new_element_indicator(value) %}
    {% if value.id is not defined or value.id is null %}
        <span class="position-absolute top-0 start-100 translate-middle p-2 bg-primary border border-light rounded-circle"
              title="{% trans %}collection_type.new_element.tooltip{% endtrans %}">
            <span class="visually-hidden">New alerts</span>
        </span>
    {% endif %}
{% endmacro %}