What is the best way to modify the buttons in the media widget - like Edit media for example.

There doesn't seem to be any theme function I can override and form alter is out as the buttons are added on #process.

If I add a #pre_render callback the buttons have already been changed from a render array to rendered HTML, so that would be a bit hacky.

I have tried adding a #process callback in hope of it running after media_element_process() but it doens't want to work so I am probably doing something wrong.

Any ideas on the best approach?

Comments

rooby’s picture

Actually, adding #pre_render in hook_fild_widget_alter() does provide what I need, it is just that the edit button is markup instead of a link array which is a bit messier in terms of overriding.

Alternately, that button could be a link array and just manually add the required ctools classes, which would be more override friendly.

Dave Reid’s picture

Status: Active » Fixed

Ok, I fixed the edit button not being an actual link array with http://drupalcode.org/project/media.git/commit/3bb0a30. That one should be way easier to modify now.

rooby’s picture

Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.