I'm trying to write a general purpose matrix template and I've come up on a little snag with tables fields. I see no way to get the column header values.
The answer here mentions craft.fields.getFieldById(block.fieldId)
but that doesn't appear to exist according to the documentation, nor did it work properly.
The closest I've gotten is this dirty slice job and that only gives me the ids of the columns. So I can do some string manipulation to get them close to the value but they can be completely different as well.
{% set first = block.table | first %}
{% set columns = first | keys | slice((first | length) / 2, first | length) %}
Any ideas would be helpful!
I'm trying to accomplish this:
<table>
<thead>
{{ loop through table headers }}
</thead>
<tbody>
{{ loop through table data }}
</tbody>
</table>