I have a Super Table field with two columns, one is a category field, the other an assets field (limit 1 on both). How can I iterate through it to get the category and asset selected for each row in the table?

$superTable = $entry->colors;
foreach ($superTable as $row) {
    // Category field handle is `color`
    // Asset field handle is `image`

    // I've tried various things here, but I don't understand how to get the fields
    // I'm looking for the category ID and asset ID in every row of the table

1 Answer 1


Assuming your Super Table field has a handle of colors, you should be able to do:

foreach ($entry->colors as $block) {
    // Color will return a category element query, so you can do:

    // Return a collection of all category ids

    // Get the first category

    // Get all the categories in the field

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.