<p>You should be able to accomplish what you want with a combination of the <a href="https://craftcms.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml" rel="nofollow noreferrer">getTableAttributeHtml()</a> hook and the <a href="https://craftcms.com/docs/plugins/hooks-reference#modifyEntryTableAttributes" rel="nofollow noreferrer">modifyEntryTableAttributes()</a> hook. You may be able to use the parameter <code>$source</code> from <code>modifyEntryTableAttributes()</code> to filter out index vs modal. </p>

<p><a href="https://craftcms.stackexchange.com/questions/9816/adding-additional-attributes-to-modifyentrytableattributes">Check out this post</a> for a more detailed description. </p>

CC BY-SA 3.0
2015-12-03T20:54:52.743Z
Okay thanks, I didn't knew 'index'/'modal' was a source actually
exophunk
CC BY-SA 3.0
2015-12-01T23:51:30.100Z
2015-12-01T23:51:30.100Z
2017-04-13T12:51:00.253Z
kcolls
<p>I am using the "Select Entry" field (<code>_includes/forms/elementSelect.html</code>) field in a custom plugin to select one of my custom element types.</p>

<p>In my ElementType, I defined <code>defineTableAttributes()</code> and <code>getTableAttributeHtml()</code> to customize the table cells on a index view of the Element.</p>

<p>Now when I am using this Element in a modal view, it displays the same cells as on the index view, but I would like to hide certain fields (like buttons).</p>

<p>Is there a way to customize the returned fields, without building the whole modal myself, like mentioned <a href="https://craftcms.stackexchange.com/questions/895/is-it-possible-to-use-the-elementtype-modal-ui-for-a-custom-field-type-plugin">here</a>?</p>

<p>I saw, that a attribute <code>context</code> gets passed, which is either <code>modal</code> or <code>index</code>, but I don't know how I could access it.</p>

<p>Thanks!</p>

<plugin-development><elementtype>
Customize elementSelect Field's Modal Table Layout
# Customize elementSelect Field's Modal Table Layout

(Asked by: username_0 on 2015-12-01)

I am using the "Select Entry" field (`_includes/forms/elementSelect.html`) field in a custom plugin to select one of my custom element types.

In my ElementType, I defined `defineTableAttributes()` and `getTableAttributeHtml()` to customize the table cells on a index view of the Element.

Now when I am using this Element in a modal view, it displays the same cells as on the index view, but I would like to hide certain fields (like buttons).

Is there a way to customize the returned fields, without building the whole modal myself, like mentioned [here](https://craftcms.stackexchange.com/questions/895/is-it-possible-to-use-the-elementtype-modal-ui-for-a-custom-field-type-plugin)?

I saw, that a attribute `context` gets passed, which is either `modal` or `index`, but I don't know how I could access it.

Thanks!

**Tags:** plugin-development, elementtype


---

## 1 answers

### Answer by username_1 on 2015-12-01. Score: 1 | Accepted answer

You should be able to accomplish what you want with a combination of the [getTableAttributeHtml()](https://craftcms.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml) hook and the [modifyEntryTableAttributes()](https://craftcms.com/docs/plugins/hooks-reference#modifyEntryTableAttributes) hook. You may be able to use the parameter `$source` from `modifyEntryTableAttributes()` to filter out index vs modal.

[Check out this post](https://craftcms.stackexchange.com/questions/9816/adding-additional-attributes-to-modifyentrytableattributes) for a more detailed description.

> **Comments:**
> **username_0**: Okay thanks, I didn't knew 'index'/'modal' was a source actually  

---

