Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
rooby CreditAttribution: rooby commentedActually, 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.
Comment #2
Dave ReidOk, 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.
Comment #3
rooby CreditAttribution: rooby commentedThanks.