When installing a module how do you require it's extension to be installed at the same time and vice versa?

I did a google search and looked over the docs as well and didn't find anything. That doesn't mean it's not out there. Maybe I wasn't searching for the right terms.

enter image description here

  • Which add-on is that? Commented Mar 8, 2013 at 18:05
  • That's Backup Pro. And I'm now seeing exactly what Derek is describing in his answer that came up as I was writing this.
    – Natetronn
    Commented Mar 8, 2013 at 18:16

1 Answer 1


This is a bit of an undocumented feature, but it works like this.

In your extension, add a class variable called $required_by, with an array of values:

$required_by = array('module');

('module' is actually the only acceptable array value here, as neither plugins nor accessories have installation routines, which are needed for this to work.)

Note that this does not automatically install (or later, uninstall) your extension. It just makes it clear that you can't install one without the other.

So your module's install() method must also install your extension (basically, everything you'd normally have in your extension's activate_extension() method). Likewise, your module's uninstall() method must contain everything your extension's disable_extension() method would normally have.

(These methods in your extension in this case should just return true.)

Have a look at the bundled Safecracker package for a good example.


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.