How get entries by sources in a frontend fieldlayout? I have multiple entries fields that I want to use in the front-end. In the field settings I'll set up a sections source for each field. On the frontend I want a dropdown select box with all the entries from section I'll setup for each entries field. If I'll dump the field sources from the field layout I'll get this:

array(1) {
  [0]=&gt;
  string(44) "section:a0977adf3fd-bd50adf-479cadf-90cd-8d5ef46de79c"
}


How to get entries related to the section source above? 

{% entries = craft.entries.section(field.sources).all() %} // This is not working


This is the code where I'll need it for some context

{% for tab in entry.fieldLayout.tabs %}
    {{ tab.name }}
    {% for field in tab.getFields() %}
            &lt;label for="{{ field.handle }}"&gt;{{ field.name }}&lt;/label&gt;
            {% if field.className == 'craft\\fields\\PlainText' %}
                {# field text settings #}
            {% elseif field.className == 'craft\\fields\\Number' %}
                {# field number settings #}
            {% elseif field.className == 'craft\\fields\\Entries' %}
                {% set entries = craft.entries.section(field.sources).all() %} 
                {# entries is empty how to fix? #}
                &lt;select name="fields[{{ field.handle }}][]"&gt;
                    &lt;option value=""&gt;Choose&lt;/option&gt;
                    {% for entry in entries %}
                        &lt;option value="{{ entry.id }}"&gt;{{ entry.title }}&lt;/option&gt;
                    {% endfor %}
                &lt;/select&gt;
            {% endif %}
    {% endfor %}
{% endfor %}
UIDs are not yet usable in queries. You would need to extract the UID of the section from the string then fetch the sectionId to use in your query. 

Something like this:

{% for tab in entry.fieldLayout.tabs %}
    {{ tab.name }}
    {% for field in tab.getFields() %}
        &lt;label for="{{ field.handle }}"&gt;{{ field.name }}&lt;/label&gt; &lt;br&gt;
        {% if field.className == 'craft\\fields\\PlainText' %}
        {# field text settings #}
        {% elseif field.className == 'craft\\fields\\Number' %}
        {# field number settings #}
        {% elseif field.className == 'craft\\fields\\Entries' %}

            {% set sources = [] %}

            {# Start our `entries` query #}
            {% set entries = craft.entries %}

            {# Iterate over sources #}
            {% for source in field.sources %}

                {# If All sources is selected in field definition, skip this #}
                {% if source != '*' %}
                    {# Extract UID from the string #}
                    {% set sectionUid = source | replace({'section:': ''}) %}

                    {# Fetch sectionId from UID and push in `sources` array #}
                    {% set sources = sources | merge([craft.app.sections.getSectionByUid(sectionUid).id]) %}
                {% endif %}
            {% endfor %}

            {# If we have `sources` then add to our query, else, fetch everything #}
            {% set entries = sources ? entries.sectionId(sources) : entries %}
            &lt;select name="fields[{{ field.handle }}][]"&gt;
                &lt;option value=""&gt;Choose&lt;/option&gt;
                {% for entry in entries.all() %}
                    &lt;option value="{{ entry.id }}"&gt;{{ entry.title }}&lt;/option&gt;
                {% endfor %}
            &lt;/select&gt;
        {% endif %}
    {% endfor %}
{% endfor %}


This will cater for multiple sources as well as All being chosen in your field definition