1

Is it possible to create a plugin that overrides a control panel template, and still be able to update Craft normally?

What I'd like to achieve:

I have a custom field with information on every asset in the assets panel. I want to see this custom field when I upload / select an asset in an entry.

Template I want to customize:

template

1

Unless I'm mistaken, it looks like you don't actually need to override that whole template. It sounds like you really just want to add a column (or multiple columns) to the assets index view.

The modal that you're showing is using the same logic as the main assets index view. So it's simply a matter of adding your own custom columns to that, and then selecting those columns to be included.

The defineAdditionalAssetTableAttributes hook allows you to create new columns for your assets index. You'll still need to select those columns via the UI in the control panel (which is super easy).

You'll probably also need to use the getAssetTableAttributeHtml hook, which allows you to customize how your column's data is displayed.

Using both of these hooks together will allow you to add whatever additional columns you'd like to the asset index view. And once you've selected your new custom columns, the exact same columns will appear in the modal view (like in your screenshot).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.