<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>

CC BY-SA 4.0
2020-05-05T08:41:35.730Z
2020-05-05T08:41:35.730Z
Oli
<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>

<field><frontend><entry-form>
How get field type in field layout
# 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 %}
        
            {{ tab.name }}
        
        {% for field in tab.getFields() %}
            
                {% if field.type == 'plainText' %}
                    {{ field.name }}
                    
                {% endif %}
            
        {% 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) 
{% if field is instance of ('craft\\fields\\PlainText') %}

or use className (docs).
{% if field.className == 'craft\\fields\\PlainText' %}

In full:
{% for tab in entry.fieldLayout.tabs %}
    
        {{ tab.name }}
    
    {% for field in tab.getFields() %}
        
            {% if field is instance of ('craft\\fields\\PlainText') %}
                {{ field.name }}
                
            {% endif %}
        
    {% endfor %}
{% endfor %}

You can see all native Craft field types here.


---

