Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-22T15:28:12.353Z
Answers.Text: But a section with a handler has a fieldLayout, right? Like the layout of the section 'news'. Which is different of the section 'event'
Answers.UserDisplayName: Jorge Anzola
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-22T15:28:55.147Z
Answers.Text: Nope, the field layout is attached to the entry type that is connected to the section, never to the section itself
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-22T15:23:36.783Z
Answers.LastActivityDate: 2018-06-22T15:23:36.783Z
Answers.UserDisplayName: Robin Schambach
Body: <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>
  
Tags: <entries><elementcriteriamodel><eager-loading>
Title: Get the fields (fieldLayout) of the section. Not the entry
ThreadText: # 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  
  
  ---
  
  