After installing a module from a given URL (on admin/modules/install), I can see the following messages:

Module installation (Update manager)

So it outputs 3 links in the "Next steps" list, but I would like to hook into the update callback process, extend this list, and provide another link which points to a callback page defined by my own module, where I can enable the module immediately. I don't need help for the latter, only for the way to hook into the process of altering/extending the messages in the result.
After hooking into to the process of generating the output (hooking into the callback process), I will need to know the module's machine name.

This is what the expected result would look like:

Update manager - new link


Update manager - new link


Update manager - new link

What would be the appropriate way to provide custom messages in the update callback?

The "Installation was completed successfully." text is defined by update_authorize_install_batch_finished() in modules/update/update.authorize.inc (and gets into $_SESSION['authorize_results']['page_message'] as an array), and the "Next steps" list is provided by ModuleUpdater::postInstallTasks in modules/system/system.updater.inc.


I think the easiest way would be to extend the ModuleUpdater class to provide your own postInstallTasks() implementation:

class MyModuleUpdater extends ModuleUpdater {

   * Overrides ModuleUpdater::postInstallTasks().
  public function postInstallTasks() {
    return array(
      l(t('Enable @module module', array('@module' => $this->title)), 'admin/modules/enable/' . $this->name),
      l(t('Install another module'), 'admin/modules/install'),
      l(t('Enable newly added modules'), 'admin/modules'),
      l(t('Administration pages'), 'admin'),


And then implement hook_updater_info_alter() to let Drupal know you want to use that class instead of the default:

function MYMODULE_updater_info_alter(&$updaters) {
  $updaters['module']['class'] = 'MyModuleUpdater';

You'll also need to add this to your module's .info file so the new class can be autoloaded:

files[] = path/to/MyModuleUpdater.php

Once you clear the caches the change should take effect.

  • Wow, Clive, that was quick and perfect! :) The module's human readable name (taken from the *.info file's name property) is available in the class with $this->title, and the machine name is available with $this->name. So I managed to output the desired link like this: l(t('Enable "@project_title" module (machine name: "@project_name")', array('@project_title' => $this->title, '@project_name' => $this->name)), 'admin/modules/enable/'.$this->name). It works: i.imgur.com/ibQUnqG.png. :) Just an interesting fact: you can not use the % as a placeholder: i.imgur.com/hbJ1ysp.png – Sk8erPeter Sep 2 '13 at 17:29
  • +1 and accepted, thank you very much! :) (Could you also include using the $this->name variable in the l() function in your answer to help others? Thanks :) ) – Sk8erPeter Sep 2 '13 at 17:29
  • Awesome, I was interested to know it that would work too ;) I've added your changes in, good finds – Clive Sep 2 '13 at 17:51
  • I didn't think it's so easy :) Thanks for adding the additional information in your answer! – Sk8erPeter Sep 2 '13 at 19:07

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.