{# 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) %}