<p>You can't get the fields from a section since sections have no field layout. Sections have several entry types and those are responsible for the fields.</p>

<pre><code>$entryType-&gt;getFieldLayout()-&gt;getFields();
</code></pre>

<p>You can get all types in a section with</p>

<pre><code>$section-&gt;getEntryTypes();
</code></pre>

CC BY-SA 4.0
2018-06-22T15:28:12.353Z
But a section with a handler has a fieldLayout, right? Like the layout of the section 'news'. Which is different of the section 'event'
Jorge Anzola
CC BY-SA 4.0
2018-06-22T15:28:55.147Z
Nope, the field layout is attached to the entry type that is connected to the section, never to the section itself
Robin Schambach
CC BY-SA 4.0
2018-06-22T15:23:36.783Z
2018-06-22T15:23:36.783Z
Robin Schambach
<p>Can I get all the fields of a section? For example, I have channel events, I want the fields in that section, but not related to any specific event.</p>

<p>I want to know all the fields (not the values), before actually executing the query.</p>

<entries><elementcriteriamodel><eager-loading>
Get the fields (fieldLayout) of the section. Not the entry
# Get the fields (fieldLayout) of the section. Not the entry

(Asked by: username_0 on 2018-06-22)

Can I get all the fields of a section? For example, I have channel events, I want the fields in that section, but not related to any specific event.

I want to know all the fields (not the values), before actually executing the query.

**Tags:** entries, elementcriteriamodel, eager-loading


---

## 1 answers

### Answer by username_1 on 2018-06-22. Score: 1 | Accepted answer

You can't get the fields from a section since sections have no field layout. Sections have several entry types and those are responsible for the fields.
$entryType->getFieldLayout()->getFields();

You can get all types in a section with
$section->getEntryTypes();

> **Comments:**
> **username_0**: But a section with a handler has a fieldLayout, right? Like the layout of the section 'news'. Which is different of the section 'event'  
> **username_1**: Nope, the field layout is attached to the entry type that is connected to the section, never to the section itself  

---

