Hello All first post here,
ok I am developing a theme for drupal 7.x and I intend to use mega-menu module, while installing modules I have seen that you can't activate a module untill you have other module it depends on, so my question is, Is there such way for themes I want my client to install the megamenu first then set my theme as default.
Ofcourse I can write all in the installation instructions for my theme, but I was just wondering if this kind of "module dependency indicating" functionality already existed?


Danny Englander’s picture

Unfortunately, a theme unlike a module cannot declare a dependancy. I wish it could! There's been an ongoing issue for that for several years now open back in 2009. At this point, it looks like if it makes into Drupal, it will be for Drupal 8 but there's always the chance it could be backported to D7. At any rate, it doesn't look like there's been much action or movement on this one is a while. Have a look:

#474684: Allow themes to declare dependencies on modules

One thing you can do is write a theme template preprocess function using function module_exists and then that way, you could potentially avoid WSODs if said modules are not enabled.

So you could do something like this:

if (module_exists('my_module')) {
// do something