{if $contents == ""}
  <div class="cf_field_comments">{$LANG.phrase_not_assigned_to_option_list}</div>
{else}
  {assign var=is_in_columns value=false}
  {if $formatting == "cf_option_list_2cols" || 
      $formatting == "cf_option_list_3cols" || 
      $formatting == "cf_option_list_4cols"}
    {assign var=is_in_columns value=true}
  {/if}

  {assign var=counter value="1"}
  {foreach from=$contents.options item=curr_group_info name=group}
    {assign var=group_info value=$curr_group_info.group_info}
    {assign var=options value=$curr_group_info.options}
    {if array_key_exists("group_name", $group_info) && !empty($group_info["group_name"])}
      <div class="cf_option_list_group_label">{$group_info.group_name}</div>
    {/if}
    {if $is_in_columns}<div class="{$formatting}">{/if}
    
    {foreach from=$options item=option name=row}
      {if $is_in_columns}<div class="column">{/if}
      <input type="radio" name="{$NAME}" id="{$NAME}_{$counter}" value="{$option.option_value}"
        {if $VALUE == $option.option_value}checked{/if} />
      <label for="{$NAME}_{$counter}">{$option.option_name}</label>
      {if $is_in_columns}</div>{/if}
      {if $formatting == "vertical"}<br />{/if}
      
      {assign var=counter value=$counter+1}
    {/foreach}
    
    {if $is_in_columns}</div>{/if}
  {/foreach}
  {if $comments}<div class="cf_field_comments">{$comments}</div>{/if}
{/if}