3

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?

1 Answer 1

3

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

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.