My theme requires multiple modules to be install before it is fully functional. How can one set module dependency in a theme, so that when a user enables the theme, it will also enable the required modules? So far, I tried to specify the dependencies in the .info file of the theme, however, no success:

dependencies[] = some_module

Any help is much appreciated.


2 Answers 2


As far as I know, this functionality doesn't exist yet (up to Drupal 7).

A feature request is already created at https://drupal.org/node/474684 (for Drupal 8).


This was introduced in Drupal 8.9.0.

Quoting the change record https://www.drupal.org/node/2937955

To declare a dependency in your theme you need to add it to the .info.yml file:

name: test theme depending on nonexisting module
type: theme
core_version_requirement: ^8 || ^9
  - drupal:test_module_non_existing

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.