Answers.Body: <p>Basically, what you want to do isn't possible – there's no hook for modifying the content in a relational field's input HTML.</p>
  
  <p>The <code>getEntryTableAttributeHtml</code> hook is meant for element indexes (such as the entry list displayed at <code>/admin/settings/entries</code>), not relational fields (such as Entries, which is what you're using in your SuperTable).</p>
  
  <p><strong>The easiest workaround would be to add the value of the <code>ingredientMeasure</code> field to your ingredient entries' title format.</strong></p>
  
  <p>First, you'll need to create a new custom field for your entries' titles – the handle <code>title</code> is reserved, so call it <code>ingredientTitle</code> or the like, and add it to your "Ingredients" section's entry type. Make the field <em>required</em>. 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:</p>
  
  <pre><code>{ingredientTitle} ({ingredientMeasure})
  </code></pre>
  
  <p>Finally – you'll need to re-save all your ingredient entries in order to have their titles updated to the new format.</p>
  
  <p>Obviously, the big tradeoff with this method is that your ingredient won't actually be titled <em>"Spinach"</em> anymore – it'll be titled something like <em>"Spinach (100g)"</em>. In your templates, this can easily be remedied by using</p>
  
  <pre><code>&lt;h1&gt;{{ entry.ingredientTitle }}&lt;/h1&gt;
  </code></pre>
  
  <p>Instead of the normal <code>entry.title</code>, wherever appropriate.</p>
  
  <p>Also, unless you want the <code>ingredientsMeasure</code> field to be part of the Ingredient entries' slugs, you should replace <code>{slug}</code> in your Ingredients Section's URL format with <code>{ingredientsTitle|kebab}</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-23T08:08:15.843Z
Answers.Text: Thanks Mats. This approach works fine - I was thinking about it at first but thought a hook would be DRY-er.It works for now but many-to-many relationships with fields in the connecting table still feel a bit hacky in Craft - it would be good if fields could be added to relations as well (eg. when an asset is linked, it gets "link fields").
Answers.UserDisplayName: Jure Srpcic
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-19T15:52:47.603Z
Answers.LastActivityDate: 2016-10-19T19:01:49.843Z
Answers.LastEditDate: 2016-10-19T19:01:49.843Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I'm using a row layout SuperTable to create a recipe (ingredients are entries). Is there a way to <strong>show another field inside the related entry (not just the title) together with the entry title?</strong> I need to specify the measure (like <em>tbsp</em>) otherwise it's hard to know the quantity for what you're editing.</p>
  
  <p><a href="https://i.sstatic.net/gKC0f.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gKC0f.png" alt="supertable connected entries"></a></p>
  
  <p>I need to show Spinach <strong>(100g)</strong> in the ingredient row. The 100g is a field called <em>ingredientMeasure</em> inside the ingredient entry.</p>
  
  <p><a href="https://i.sstatic.net/szIkS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/szIkS.png" alt="ingredient entry"></a></p>
  
  <p>I was thinking about using a hook (modifyEntryTableAttributes) - but not sure how to do it with ST. This is my hook example (from Ben's plugin tutorial):</p>
  
  <pre><code>// ADD A HOOK - modify the contents of table cell on entry index page
  public function getEntryTableAttributeHtml(EntryModel $entry, $attribute) {
      // check if setting is enabled and we're editing our column
      if ($this-&gt;getSettings()-&gt;showCountOnEntryIndex AND $attribute == 'count')
      {
          return 'C&lt;b&gt;' . craft()-&gt;entryCount-&gt;getCount($entry-&gt;id)-&gt;count . '&lt;/b&gt;';
      }
  }
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-11-09T17:41:35.497Z
Comments.Text: I have the same question and found this old topic . Is it possible today to prepend a field value to the title in an entry field? For example: „date: title“
Comments.UserDisplayName: buckdanny
Tags: <control-panel><hook><plugin-supertable>
Title: How to show details on linked entry in CP (another field inside related entry)
ThreadText: # How to show details on linked entry in CP (another field inside related entry)
  
  (Asked by: username_0 on 2016-10-19)
  
  I'm using a row layout SuperTable to create a recipe (ingredients are entries). Is there a way to **show another field inside the related entry (not just the title) together with the entry title?** I need to specify the measure (like *tbsp*) otherwise it's hard to know the quantity for what you're editing.
  
  [![supertable connected entries](https://i.sstatic.net/gKC0f.png)](https://i.sstatic.net/gKC0f.png)
  
  I need to show Spinach **(100g)** in the ingredient row. The 100g is a field called *ingredientMeasure* inside the ingredient entry.
  
  [![ingredient entry](https://i.sstatic.net/szIkS.png)](https://i.sstatic.net/szIkS.png)
  
  I was thinking about using a hook (modifyEntryTableAttributes) - but not sure how to do it with ST. This is my hook example (from Ben's plugin tutorial):
  
  ```
  // ADD A HOOK - modify the contents of table cell on entry index page
  public function getEntryTableAttributeHtml(EntryModel $entry, $attribute) {
      // check if setting is enabled and we're editing our column
      if ($this->getSettings()->showCountOnEntryIndex AND $attribute == 'count')
      {
          return 'C<b>' . craft()->entryCount->getCount($entry->id)->count . '</b>';
      }
  }
  
  ```
  
  **Tags:** control-panel, hook, plugin-supertable
  
  > **Comments:**
  > **username_1**: I have the same question and found this old topic . Is it possible today to prepend a field value to the title in an entry field? For example: „date: title“  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-10-19. Score: 3 | Accepted answer
  
  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}`.
  
  > **Comments:**
  > **username_0**: Thanks username_2. This approach works fine - I was thinking about it at first but thought a hook would be DRY-er.It works for now but many-to-many relationships with fields in the connecting table still feel a bit hacky in Craft - it would be good if fields could be added to relations as well (eg. when an asset is linked, it gets "link fields").  
  
  ---
  
  