Is there documentation on using PHP to change the display of list fields on form pages?

If you add a list field and enable multi columns, it display something like this:

<table>
    <tr>
        <td>Field 1</td>
        <td>Field 2</td>
        <td>Field 3</td>
        <td>Add Button</td>
    </tr>
</table>

I want to adjust this display on my form so it’s more like:

<table>
    <tr>
        <td>Field 1</td>
        <td>Field 2</td>
        <td>Field 3</td>
    </tr>
    <tr>
        <td colspan="3">Add Button</td>
    </tr>
</table>

Just as a quick example. I know this isn’t a feature that’s built into the admin UI but I’m pretty sure there’s a built in way to add your own PHP to do this and I’d be happy to try it but I can’t find the documentation anywhere on how you edit this yourself. Can someone point me in the right direction to the documentation for this?

There is no PHP specifically to change the table output of a list field. However, you can filter the whole form object, and modify the markup before the form is displayed:

That would work for the first line of a list field. Because the other lines are generated client side after being shown in the browser, I am not sure if the clone method will work exactly right when adding a new row. It’s worth a try :slight_smile:

That’s more complex than I was hoping for. Looking at that doc I don’t understand how you would edit the initial state of a single field.

Perhaps the devs could add a feature request to stop using tables to display their fields since it’s so outdated and makes it near impossible to manipulate easily. It would take them a day to switch to CSS grid or flex and this would improve the form’s ease of use tremendously.

We are planning on reworking the output of the form fields (with new filters) in v2.5 which is in development now.