Answers.Body: <p>According to the <a href="https://github.com/fruitstudios/Icons/#usage" rel="nofollow">docs for the Icons plugin</a>, <code>icon</code> is actually an <strong>object</strong>. Try this instead...</p>
  
  <pre><code>&lt;i class="fa {{ block.icon.class }}"&gt;&lt;/i&gt;
  </code></pre>
  
  <p>In both scenarios, I'd take another look at your rendered HTML... your first example may actually be rendering the word <code>Array</code> instead of the class name that you are looking for. You can also leave off the leading <code>fa-</code>, since that will be automatically included in the class name.</p>
  
  <p>Where you have called <code>icon</code> in both examples, you're simply referring to <em>the field itself</em>. You actually want to be referring to the <em>values of the field</em>.</p>
  
  <p>To output the HTML you're looking for, either of these two options will work:</p>
  
  <ol>
  <li><code>{{ block.icon.icon }}</code></li>
  <li><code>&lt;i class="fa {{ block.icon.class }}"&gt;&lt;/i&gt;</code></li>
  </ol>
  
  <p>And for your non-matrix example, just replace <code>block</code> with <code>point</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-12T06:32:44.310Z
Answers.Text: This worked, any idea why it worked without that in one instance and required it in another?
Answers.UserDisplayName: Christopher Healey
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-12T06:34:37.237Z
Answers.Text: Are you sure the `point` instance was generating the right HTML code? (Was the icon actually showing up?) According to the plugin docs, that code snippet shouldn't have worked.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-12T08:03:55.097Z
Answers.Text: Yep, showed up and worked EXACTLY as intended.
Answers.UserDisplayName: Christopher Healey
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-11T16:03:31.037Z
Answers.LastActivityDate: 2014-08-11T16:19:53.983Z
Answers.LastEditDate: 2014-08-11T16:19:53.983Z
Answers.UserDisplayName: Lindsey D
Body: <p>I have 2 bits of code that should be about identical with the exception of one being in a Matrix and one not. The bit that is not looks like this:</p>
  
  <pre><code>&lt;ul&gt;
      {% for point in entry.keyPoints %}
          &lt;li&gt;
              &lt;div class="a-ico"&gt;
                  &lt;i class="fa fa-{{ point.icon }}"&gt;&lt;/i&gt;
              &lt;/div&gt;
              &lt;div class="a-info"&gt;
                  &lt;h4&gt;{{ point.heading }}&lt;/h4&gt;
                  {{ point.text }}
              &lt;/div&gt;
          &lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>This works exactly as intended. and uses the "ICON" 3rd-party field type which essentially is a dropdown that allows me to pick which icon I want to use.</p>
  
  <p>The code that i'm having trouble with is:</p>
  
  <pre><code>{% for block in entry.articleBody %}
      {% if block.type == "text" %}
           Some stuff here
      {% elseif block.type =="iconSection" %}
          {% if block.getPrev() %}
              {% if block.getPrev().type != "iconSection" %}
                  &lt;ul&gt;
              {% endif %}
          {% else %}
              &lt;ul&gt;
          {% endif %}
          &lt;li&gt;
              &lt;div class="a-ico"&gt;
                  &lt;i class="fa fa-{{ block.icon }}"&gt;&lt;/i&gt;
              &lt;/div&gt;
              &lt;div class="a-info"&gt;
                  &lt;h4&gt;{{ block.heading }}&lt;/h4&gt;
                  {{ block.text }}
              &lt;/div&gt;
          &lt;/li&gt;
          {% if block.getNext() %}
              {% if block.getNext().type != "iconSection" %}
                  &lt;/ul&gt;
              {% endif %}
          {% else %}
              &lt;/ul&gt;
          {% endif %}
      {% elseif block.type =="video" %}
          some stuff here
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>It is saying Template Error (Array to String Conversion) with this bit highlighted:</p>
  
  <pre><code>&lt;i class="fa fa-{{ block.icon }}"&gt;&lt;/i&gt;
  </code></pre>
  
  <p>As you can see the code is almost identical except it is BLOCK instead of POINT, and the block one is in a matrix where as the point item is not. What might be causing this and how might I resolve it?</p>
  
Tags: <matrix><array>
Title: Array to string conversion Template Error
ThreadText: # Array to string conversion Template Error
  
  (Asked by: username_0 on 2014-08-11)
  
  I have 2 bits of code that should be about identical with the exception of one being in a Matrix and one not. The bit that is not looks like this:
  
  ```
  <ul>
      {% for point in entry.keyPoints %}
          <li>
              <div class="a-ico">
                  <i class="fa fa-{{ point.icon }}"></i>
              </div>
              <div class="a-info">
                  <h4>{{ point.heading }}</h4>
                  {{ point.text }}
              </div>
          </li>
      {% endfor %}
  </ul>
  
  ```
  
  This works exactly as intended. and uses the "ICON" 3rd-party field type which essentially is a dropdown that allows me to pick which icon I want to use.
  
  The code that i'm having trouble with is:
  
  ```
  {% for block in entry.articleBody %}
      {% if block.type == "text" %}
           Some stuff here
      {% elseif block.type =="iconSection" %}
          {% if block.getPrev() %}
              {% if block.getPrev().type != "iconSection" %}
                  <ul>
              {% endif %}
          {% else %}
              <ul>
          {% endif %}
          <li>
              <div class="a-ico">
                  <i class="fa fa-{{ block.icon }}"></i>
              </div>
              <div class="a-info">
                  <h4>{{ block.heading }}</h4>
                  {{ block.text }}
              </div>
          </li>
          {% if block.getNext() %}
              {% if block.getNext().type != "iconSection" %}
                  </ul>
              {% endif %}
          {% else %}
              </ul>
          {% endif %}
      {% elseif block.type =="video" %}
          some stuff here
      {% endif %}
  {% endfor %}
  
  ```
  
  It is saying Template Error (Array to String Conversion) with this bit highlighted:
  
  ```
  <i class="fa fa-{{ block.icon }}"></i>
  
  ```
  
  As you can see the code is almost identical except it is BLOCK instead of POINT, and the block one is in a matrix where as the point item is not. What might be causing this and how might I resolve it?
  
  **Tags:** matrix, array
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-08-11. Score: 3 | Accepted answer
  
  According to the [docs for the Icons plugin](https://github.com/fruitstudios/Icons/#usage), `icon` is actually an **object**. Try this instead...
  
  ```
  <i class="fa {{ block.icon.class }}"></i>
  
  ```
  
  In both scenarios, I'd take another look at your rendered HTML... your first example may actually be rendering the word `Array` instead of the class name that you are looking for. You can also leave off the leading `fa-`, since that will be automatically included in the class name.
  
  Where you have called `icon` in both examples, you're simply referring to *the field itself*. You actually want to be referring to the *values of the field*.
  
  To output the HTML you're looking for, either of these two options will work:
  
  1. `{{ block.icon.icon }}`
  2. `<i class="fa {{ block.icon.class }}"></i>`
  
  And for your non-matrix example, just replace `block` with `point`.
  
  > **Comments:**
  > **username_0**: This worked, any idea why it worked without that in one instance and required it in another?  
  > **username_1**: Are you sure the `point` instance was generating the right HTML code? (Was the icon actually showing up?) According to the plugin docs, that code snippet shouldn't have worked.  
  > **username_0**: Yep, showed up and worked EXACTLY as intended.  
  
  ---
  
  