<p>To make it possible to select fields from a custom FieldType in the Customizable Element Indexes interface, your FieldType class needs to implement the <a href="https://craftcms.com/classreference/fieldtypes/IPreviewableFieldType" rel="nofollow"><code>IPreviewableFieldType</code></a> interface, like this:</p>

<pre><code>class ExamplePluginHandleFieldType extends BaseFieldType implements IPreviewableFieldType
{
    ...
</code></pre>

<p>If you want to modify how the values from your custom FieldType displays in element indexes, you need to add a <code>getTableAttributeHtml</code> method to your FieldType class:</p>

<pre><code>public function getTableAttributeHtml($value)
{
    return $value ? $value-&gt;id : null;
}
</code></pre>

CC BY-SA 3.0
2016-09-21T07:59:16.280Z
2016-09-21T07:59:16.280Z
Mats Mikkel Rummelhoff
<p>I've built a custom FieldType, and I'd like editors to be able to add any fields using this FieldType to element indexes. Unfortunately, fields using my custom FieldType aren't included in the list of fields in the Customizable Element Index configurator.</p>

<p>How can I make it possible to add fields using my custom FieldType to element indexes?</p>

<p>Also, is it possible to define how the value returned from my custom FieldType displays in the element index?</p>

<plugin-development><fieldtypes><custom-fieldtype>
How can I make my custom FieldType show up in an element index?
# How can I make my custom FieldType show up in an element index?

(Asked by: username_0 on 2016-09-21)

I've built a custom FieldType, and I'd like editors to be able to add any fields using this FieldType to element indexes. Unfortunately, fields using my custom FieldType aren't included in the list of fields in the Customizable Element Index configurator.

How can I make it possible to add fields using my custom FieldType to element indexes?

Also, is it possible to define how the value returned from my custom FieldType displays in the element index?

**Tags:** plugin-development, fieldtypes, custom-fieldtype

---

## 1 answers

### Answer by username_0 on 2016-09-21. Score: 3 | Accepted answer

To make it possible to select fields from a custom FieldType in the Customizable Element Indexes interface, your FieldType class needs to implement the IPreviewableFieldType interface, like this:
class ExamplePluginHandleFieldType extends BaseFieldType implements IPreviewableFieldType
{
    ...

If you want to modify how the values from your custom FieldType displays in element indexes, you need to add a getTableAttributeHtml method to your FieldType class:
public function getTableAttributeHtml($value)
{
    return $value ? $value->id : null;
}


---

