Is there any method to override this function theme_file_widget.

I tried to to do the following in my module.

function mymodule_file_widget($variables)

and also in my theme

function mytheme_file_widget($variables)

but did not work. I cleared the cache also. Is there any method to override this function?

1 Answer 1


The correct way to override the theme function is:

 * Implements hook_theme_registry_alter().
function mymodule_theme_registry_alter(&$theme_registry) {
  $theme_registry['file_widget']['function'] = 'mymodule_file_widget';

function mymodule_file_widget($variables) {
 //your code

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.