templates\parts\_grid.html.twig line 1

Open in your IDE?
  1. {% set countIteration = 1 %}
  2. {% set openFlag = 0 %} 
  3. {% set closeFlag = 0 %} 
  4. {% set makeGap = false %} 
  5. {% for field in businessRulesData%}
  6.     {# set prev and next fields #}
  7.     {% if businessRulesData[loop.index] is defined %}
  8.         {% set nextField = businessRulesData[loop.index] %} 
  9.     {% else %}
  10.         {% set nextField = null %} 
  11.     {% endif %}
  12.     {% if businessRulesData[loop.index-2] is defined %}
  13.         {% set prevField = businessRulesData[loop.index-2] %} 
  14.     {% else %}
  15.         {% set prevField = null %} 
  16.     {% endif %}
  17.     
  18.     {# update counter #}
  19.     {% if
  20.         countIteration == 1
  21.         and prevField is not null
  22.         and prevField['control'] != "radio"
  23.         and (field['visible']==1)
  24.         and(field['control'] != "radio")
  25.     %}                        
  26.         {% set countIteration = 2 %}
  27.     {% elseif
  28.         countIteration == 2
  29.         and (field['visible']==1) 
  30.         and(field['control'] != "radio")
  31.     %}
  32.         {% set countIteration = 1 %}    
  33.     {% endif %}
  34.         
  35.     {# make gap #}    
  36.     {% if
  37.         countIteration == 1
  38.         and (nextField is null
  39.                 or (nextField is not null 
  40.                     and nextField['control'] == "radio")
  41.                 )
  42.         and (field['visible']==1)
  43.         and(field['control'] != "radio")
  44.     %}    
  45.         {% set makeGap = true %}
  46.     {% elseif countIteration == 2 %}
  47.         {% set makeGap = false %}
  48.     {% endif %}
  49.         
  50.      {# open two rows? #} 
  51.     {% if 
  52.             countIteration==1
  53.             and field['visible']==1
  54.             and field['control'] != "radio"
  55.             and (
  56.                     nextField is not null
  57.                     and nextField['visible']!=0
  58.             )
  59.             and (
  60.                     nextField is null 
  61.                     or nextField['control'] != "radio"
  62.                 )
  63.     %}        
  64.         {% set openFlag = 1 %}
  65.     {% else %}
  66.         {% set openFlag = 0 %}
  67.     {% endif %}        
  68.     {# close two rows? #}
  69.     {% if         
  70.         countIteration==2  
  71.         and field['visible']==1
  72.         and field['control'] != "radio" 
  73.         and (
  74.             prevField is not null
  75.             and prevField['visible']!=0
  76.             )
  77.         and (
  78.             prevField is null 
  79.             or prevField['control'] != "radio"
  80.             )
  81.     %}
  82.         {% set closeFlag = 1 %}
  83.     {% else %}
  84.         {% set closeFlag = 0 %}
  85.     {% endif %}
  86.     
  87.     
  88.     
  89.         
  90.     {# open wrapper div #}  
  91.     {#{{ dump(countIteration) }}
  92.     {{ dump(makeGap) }}#}
  93.     {% if openFlag==1 or makeGap == true %}        
  94.         <div class="form__grid form__grid--md">
  95.     {% endif %}
  96.         {% if (field.sectionName == sectionName) %}  
  97.             {% include 'forms/signup/_field-templates-list.html.twig' %}            
  98.             {% if makeGap == true %}
  99.                 <div class="form__field"></div>                 
  100.             {% endif %}
  101.         {% endif %}
  102.         
  103.         
  104.     {# close wrapper div #}
  105.     {% if closeFlag==1 or makeGap == true %}
  106.         </div>
  107.         {% set makeGap = false %}
  108.     {% endif %}
  109.              
  110.     
  111.     
  112.                         
  113. {% endfor %}