Answers.Body: <p>You can use the <code>instance of</code> test (<a href="https://docs.craftcms.com/v3/dev/tests.html#instance-of" rel="nofollow noreferrer">docs</a>) </p>
  
  <pre><code>{% if field is instance of ('craft\\fields\\PlainText') %}
  </code></pre>
  
  <p>or use <code>className</code> (<a href="https://docs.craftcms.com/v3/dev/functions.html#classname" rel="nofollow noreferrer">docs</a>).</p>
  
  <pre><code>{% if field.className == 'craft\\fields\\PlainText' %}
  </code></pre>
  
  <p>In full:</p>
  
  <pre><code>{% for tab in entry.fieldLayout.tabs %}
      &lt;div class="form__row"&gt;
          &lt;h3&gt;{{ tab.name }}&lt;/h3&gt;
      &lt;/div&gt;
      {% for field in tab.getFields() %}
          &lt;div class="form__row"&gt;
              {% if field is instance of ('craft\\fields\\PlainText') %}
                  &lt;label for="etg"&gt;{{ field.name }}&lt;/label&gt;
                  &lt;input type="text" name="fields[{{ field.handle }}]" value="{{ attribute(entry, field.handle)}}"&gt;
              {% endif %}
          &lt;/div&gt;
      {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>You can see <a href="https://docs.craftcms.com/v3/fields.html#field-types" rel="nofollow noreferrer">all native Craft field types here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-05T08:41:35.730Z
Answers.LastActivityDate: 2020-05-05T08:41:35.730Z
Answers.UserDisplayName: Oli
Body: <p>I'am building a website (craftcms 3.4+) where I'll need frontend entry editing. Therefore I'll need the fieldlayout of an entry. This is what I'll have:</p>
  
  <pre><code>{% for tab in entry.fieldLayout.tabs %}
          &lt;div class="form__row"&gt;
              &lt;h3&gt;{{ tab.name }}&lt;/h3&gt;
          &lt;/div&gt;
          {% for field in tab.getFields() %}
              &lt;div class="form__row"&gt;
                  {% if field.type == 'plainText' %}
                      &lt;label for="etg"&gt;{{ field.name }}&lt;/label&gt;
                      &lt;input type="text" name="fields[{{ field.handle }}]" value="{{ attribute(entry, field.handle)}}"&gt;
                  {% endif %}
              &lt;/div&gt;
          {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>The problem of this is that <code>field.type</code> not excist. I'll need that because of the different field types I'm using. How I'll get the th</p>
  
Tags: <field><frontend><entry-form>
Title: How get field type in field layout
ThreadText: # How get field type in field layout
  
  (Asked by: username_0 on 2020-05-04)
  
  I'am building a website (craftcms 3.4+) where I'll need frontend entry editing. Therefore I'll need the fieldlayout of an entry. This is what I'll have:
  
  ```
  {% for tab in entry.fieldLayout.tabs %}
          <div class="form__row">
              <h3>{{ tab.name }}</h3>
          </div>
          {% for field in tab.getFields() %}
              <div class="form__row">
                  {% if field.type == 'plainText' %}
                      <label for="etg">{{ field.name }}</label>
                      <input type="text" name="fields[{{ field.handle }}]" value="{{ attribute(entry, field.handle)}}">
                  {% endif %}
              </div>
          {% endfor %}
  {% endfor %}
  
  ```
  
  The problem of this is that `field.type` not excist. I'll need that because of the different field types I'm using. How I'll get the th
  
  **Tags:** field, frontend, entry-form
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-05-05. Score: 2 | Accepted answer
  
  You can use the `instance of` test ([docs](https://docs.craftcms.com/v3/dev/tests.html#instance-of))
  
  ```
  {% if field is instance of ('craft\\fields\\PlainText') %}
  
  ```
  
  or use `className` ([docs](https://docs.craftcms.com/v3/dev/functions.html#classname)).
  
  ```
  {% if field.className == 'craft\\fields\\PlainText' %}
  
  ```
  
  In full:
  
  ```
  {% for tab in entry.fieldLayout.tabs %}
      <div class="form__row">
          <h3>{{ tab.name }}</h3>
      </div>
      {% for field in tab.getFields() %}
          <div class="form__row">
              {% if field is instance of ('craft\\fields\\PlainText') %}
                  <label for="etg">{{ field.name }}</label>
                  <input type="text" name="fields[{{ field.handle }}]" value="{{ attribute(entry, field.handle)}}">
              {% endif %}
          </div>
      {% endfor %}
  {% endfor %}
  
  ```
  
  You can see [all native Craft field types here](https://docs.craftcms.com/v3/fields.html#field-types).
  
  
  ---
  
  