I'm building a front-end form, where I'm displaying on front-end my fields following their layout within the CP:
{% set section = craft.app.sections.getSectionByHandle('handle') %}
{% set fieldLayoutId = section.getEntryTypes[0].getFieldLayout().id %}
{% set fieldLayoutTabs = craft.app.fields.getLayoutTabsById(fieldLayoutId) %}
{% for tab in fieldLayoutTabs %}
{% for field in tab.elements %}
{% if field is instance of("craft\\fieldlayoutelements\\CustomField") %}
<pre>
{{ dump(field) }}
</pre>
{% endif %}
{% endfor %}
{% endfor %}
On the CP, I showing/hiding some fields based on a Lightswitch value, currently thanks to the Reasons plugin, as there're still no native way.
I would like to be able to get at least these rules on front-end, to be able to build a front-end show/hide feature for my form, using the field layout loop.
Is there any way to get the Reasons' fields settings on front-end? Or is there any alternative to achieve this?