How can you check if a field exists in a section, not by entry? For a plugin, I need to check if a certain field exists in a section. How can i manage that? I'm using the settings section from the plugin, looping through all sections by craft()-&gt;sections-&gt;getAllSections() and in the template with the following code:

{% for section in sections %}
    {% if section['specificfield'] is not defined %}
        do something
    {% endif %}
{% endfor %}


This doesn't seem to be working. Any ideas on how to check correctly?
The solution is to getEntryTypes() from your section and then access the getFieldLayout() to get to the getFields() (thanks again @Khalwat!). Example:

{% for section in sections %}
    {% if section.getEntryTypes()[0].getFieldLayout().getFields()[0].getField().handle == 'specificfield' %}
        do something
    {% endif %}
{% endfor %}


Notice though that I specifically search for the first occurances, in (most) other cases you should foreach the getEntryTypes() and getFields()