{# Variables - totalWeight - variant - variants - abTestResults - actionRoute - activeEntity - model - nameGetter - firstCriteria (optional) #} {% set id = variant.id %} {% if variants.properties[id] is not defined %} {% set settings = variant.variantSettings %} {% set variants = variants|merge({ 'properties': variants.properties|merge({ (id): settings, }) }) %} {% endif %} {% if variants.properties[id] is not empty %} {% set thisCriteria = variants.properties[id].winnerCriteria %} {% set weight = variants.properties[id].weight %} {% set criteriaLabel = thisCriteria ? variants.criteria[thisCriteria].label|trans : '' %} {% else %} {% set thisCriteria, criteriaLabel, weight = '', '', 0 %} {% endif %} {% set isPublished = variant.isPublished %} {% set totalWeight = totalWeight + (isPublished ? weight : 0) %} {% set firstCriteria = firstCriteria|default(thisCriteria) %} {% set isWinner = abTestResults.winners is defined and variant.id in abTestResults.winners and variants.parent.variantStartDate and isPublished %} {% set actionUrl = path(actionRoute, {'objectAction': 'view', 'objectId': variant.id}) %} {% set isCurrent = (variant.id is same as activeEntity.id) %}
  • {{ include('@MauticCore/Helper/publishstatus_icon.html.twig', { 'item': variant, 'model': model, 'size': '', 'query': 'size=', }) }}

    {% if isWinner %} {% endif %}
    {{ attribute(variant, nameGetter) }} {% if isCurrent %}  {{ 'mautic.core.current'|trans }} {% endif %} {% if variants.parent.id is same as variant.id %}  {{ 'mautic.core.parent'|trans }} {% endif %} {% if variant is instanceof('\\Mautic\\CoreBundle\\Entity\\TranslationEntityInterface') and variant.isTranslation %}   {% endif %}
    {% if method_exists(variant, 'getAlias') %} {{ variant.alias }} {% endif %}
    {% if isPublished and (totalWeight > 100 or (thisCriteria and firstCriteria != thisCriteria)) %}
    {{ weight }}%
    {{ criteriaLabel }}
    {% elseif isPublished and criteriaLabel %}
    {{ weight }}%
    {{ criteriaLabel }}
    {% else %}
    {{ weight }}%
    {{ criteriaLabel }}
    {% endif %}