Basically, what you want to do isn't possible – there's no hook for modifying the content in a relational field's input HTML.
The getEntryTableAttributeHtml
hook is meant for element indexes (such as the entry list displayed at /admin/settings/entries
), not relational fields (such as Entries, which is what you're using in your SuperTable).
The easiest workaround would be to add the value of the ingredientMeasure
field to your ingredient entries' title format.
First, you'll need to create a new custom field for your entries' titles – the handle title
is reserved, so call it ingredientTitle
or the like, and add it to your "Ingredients" section's entry type. Make the field required. Second, you'll need to go into your "Ingredients" section's entry type settings, and uncheck the "Show the Title field" checkbox. Then, add something like this to "Title format" field:
{ingredientTitle} ({ingredientMeasure})
Finally – you'll need to re-save all your ingredient entries in order to have their titles updated to the new format.
Obviously, the big tradeoff with this method is that your ingredient won't actually be titled "Spinach" anymore – it'll be titled something like "Spinach (100g)". In your templates, this can easily be remedied by using
<h1>{{ entry.ingredientTitle }}</h1>
Instead of the normal entry.title
, wherever appropriate.
Also, unless you want the ingredientsMeasure
field to be part of the Ingredient entries' slugs, you should replace {slug}
in your Ingredients Section's URL format with {ingredientsTitle|kebab}
.