verbb / super-table

Super-charge your Craft workflow using Super Table.
MIT License
316 stars 47 forks source link

Expose column headings to template #521

Closed foxtrotcz closed 1 year ago

foxtrotcz commented 1 year ago

What are you trying to do?

I am using Super Table because it offers Raw Layout and I was trying to access column headings in template. I found this guide: https://craftcms.stackexchange.com/questions/2148/show-a-table-fields-column-headers-in-template

But it doesnt work for Super Table.

What's your proposed solution?

Look like it's because Super Table doesnt expose column headings. Example of dump() for inbuilt Table field. image

And this is dump of Super Table. image

As you can see Super Table is missing heading, handle and type in columns section. If heading was added it could be accessed in template and used.

Thanks.

Additional context

No response

foxtrotcz commented 1 year ago

Luckily I found another solution. The name of heading is also here: image

Accessible with this query:

        {% set field = craft.app.fields.getFieldByHandle("superTable1").getBlockTypeFields() %}

        {% for item in field %}
         {{ item.name }}
        {% endfor %}

I would still like some more officially supported solution but this also works.