{% block oro_combobox_dataconfig_entity_field_choice %}
    $field.data('entity-field-util', new EntityFieldUtil($field));

    {% if configs.entities is defined %}
    var entities = {{ configs.entities|json_encode|raw }};
    $field.data('entity-field-util').findEntity = function (entity) {
        return _.findWhere(entities, {name: entity});
    };
    {% endif %}
    var formatContext = {
        getFieldData: function (fieldId) {
            return $field.data('entity-field-util').getFieldData(fieldId);
        }
    };
    select2Config.formatContext = function () {
        return formatContext;
    };
{% endblock %}

{% block oro_combobox_dataconfig_entity_field_select %}
    {{ block('oro_combobox_dataconfig_entity_field_choice') }}

    var formatContext = {
        getFieldData: function (fieldId) {
            return $field.data('entity-field-util').getFieldData(fieldId);
        },
        splitFieldId: function (fieldId) {
            return $field.data('entity-field-util').splitFieldId(fieldId);
        }
    };
    select2Config.formatContext = function () {
        return formatContext;
    };

    select2Config.collapsibleResults = true;
    select2Config.data = function () {
        return {more: false, results: $field.data('entity-field-util')._getData() };
    }
{% endblock %}

{% block oro_combobox_dataconfig_entity_field_base %}
    $field.data('entity-field-util', new EntityFieldUtil($field));

    {% if configs.entities is defined %}
    var entities = {{ configs.entities|json_encode|raw }};
    $field.data('entity-field-util').findEntity = function (entity) {
        return _.findWhere(entities, {name: entity});
    };
    {% endif %}

    var formatContext = {
        getFieldData: function (fieldId) {
            return $field.data('entity-field-util').getFieldData(fieldId);
        },
        splitFieldId: function (fieldId) {
            return $field.data('entity-field-util').splitFieldId(fieldId);
        }
    };
    select2Config.formatContext = function () {
        return formatContext;
    };
{% endblock %}

{% block oro_combobox_dataconfig_entity_field_choice %}
    {{ block('oro_combobox_dataconfig_entity_field_base') }}
{% endblock %}

{% block oro_combobox_dataconfig_entity_field_select %}
    {{ block('oro_combobox_dataconfig_entity_field_base') }}

    select2Config.collapsibleResults = true;
    select2Config.data = function () {
        return {more: false, results: $field.data('entity-field-util')._getData() };
    }
{% endblock %}

Develop UI for segmentation builder
BAP-2731: Develop UI for segmentation builder
