Is there any function in Drupal like get_module_info('MODULE_NAME')
or I should parse info
file?
views:
51answers:
2
+3
A:
drupal_parse_info_file is the closest function, but it takes a file path, not a module name, so you have to convert the name into the path first:
$path = drupal_get_path('module', $name) . '/' . $name . '.info'
$info = drupal_parse_info_file($path);
Scott Reynen
2010-10-01 13:33:28
This is the thing I was looking for! Thanks )
sultan
2010-10-02 03:55:33
+2
A:
If you happen to be using the Features module, it has created a solid structure for interacting with the System table that is readily adaptable for any module info gathering.
To get information about a module, use features_get_modules($module_name)
. This dispatches a module-specific request to features_get_info()
on line 475 of features.module.
The information is cached, and you can make use of hook_system_info_alter() to modify the values you need. Note that this functionality is not touched by anything in Drupal core, and is only useful for your own custom module functionality.
Grayside
2010-10-01 15:57:33