I am looking to create a stylized theme for the progress bar for the batch API screen. I wish to alter the HTML and CSS being displayed in order to do so.

I know how to add the CSS to the page. I am aware of the hook theme_progress_bar, but according to the documentation "Note that the core Batch API uses this only for non-JavaScript batch jobs.".

What is the best method for overriding the HTML for AJAX driven batch API jobs?

2 Answers 2


Ultimately decided to use the hook hook_js_alter() in order to replace misc/progress.js with my own version. You can declare your own markup in this file, and also react on progress update (every 1500 ms out of the box).

In case anyone was wondering, this is the outcome of this http://drupal.org/project/nyan

  • 1
    The one small issue with this approach is that you should look out for updates to misc/progress.js every time you update Drupal core to a 7.x minor release and merge them with your "overriding" file. Neat project, though. :) Commented Dec 19, 2012 at 10:13
  • Yeah, that is an issue, luckily the JS file is relatively small and seems stable.
    – wiifm
    Commented Dec 19, 2012 at 19:58

It depends on how much you want to alter it. It can be modified pretty simply with CSS. Are you absolutely sure there's no way to do what you want with CSS only? If you're trying to completely change the way it works, have a look at the ajax.inc file - you'll see this

    • #ajax['progress']: Choose either a throbber or progress bar that is * displayed while awaiting a response from the callback, and add an optional * message. Possible keys: 'type', 'message', 'url', 'interval'.

It doesn't support a custom "type". So there's not a clean way to do it through the AJAX API itself, but you could theoretically make changes on the client side with a jQuery plugin. A starting point for that would be to override the Drupal.ajax.prototype.success function in misc/ajax.js in your theme.

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.