Skip to main content
added 13 characters in body
Source Link

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}.

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 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}.

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}.

deleted 230 characters in body
Source Link

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 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} ({mealIngredients.ingredientMeasure})

Note that the above assumes the SuperTable fields' handle is mealIngredients. Also note that if your SuperTable is not static, you'll need to do this instead:

{ingredientTitle} ({mealIngredients.first.ingredientMeasure})

Finally – you'll need to re-save all your ingrendientingredient entries in order to have their titles updated to the new format (remember to fill in the ingredientTitle custom field!).

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 SuperTableingredientsMeasure field to be part of the Ingredient entries' slugs, you should replace {slug} in your Ingredients Section's URL format with {ingredientsTitle|kebab}.

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 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. 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} ({mealIngredients.ingredientMeasure})

Note that the above assumes the SuperTable fields' handle is mealIngredients. Also note that if your SuperTable is not static, you'll need to do this instead:

{ingredientTitle} ({mealIngredients.first.ingredientMeasure})

Finally – you'll need to re-save all your ingrendient entries in order to have their titles updated to the new format (remember to fill in the ingredientTitle custom field!).

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 SuperTable field to be part of the entries' slugs, you should replace {slug} in your Ingredients Section's URL format with {ingredientsTitle|kebab}.

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 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}.

Source Link

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 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. 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} ({mealIngredients.ingredientMeasure})

Note that the above assumes the SuperTable fields' handle is mealIngredients. Also note that if your SuperTable is not static, you'll need to do this instead:

{ingredientTitle} ({mealIngredients.first.ingredientMeasure})

Finally – you'll need to re-save all your ingrendient entries in order to have their titles updated to the new format (remember to fill in the ingredientTitle custom field!).

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 SuperTable field to be part of the entries' slugs, you should replace {slug} in your Ingredients Section's URL format with {ingredientsTitle|kebab}.