Last active
December 20, 2015 16:39
-
-
Save AndreBaumeier/6163419 to your computer and use it in GitHub Desktop.
Drupal: get all enabled dependencies for a module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bit_get_enabled_dependencies($module) { | |
$dependencies=array(); | |
// Get all module data so we can find dependencies and sort. | |
$module_data = system_rebuild_module_data(); | |
// Get all dependencies for a module | |
if (isset($module_data[$module])) { | |
foreach ($module_data[$module]->required_by as $required_module => $required_module_data) { | |
if (!in_array($required_module, $dependencies)) { | |
if (module_exists($required_module)) { | |
$dependencies[]=$required_module; | |
} | |
} | |
} | |
} | |
return $dependencies; | |
} | |
dpm(bit_get_enabled_dependencies('privatemsg')); | |
dpm(bit_get_enabled_dependencies('panels')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment