3

I am using module_list() to get a list of all modules, but I want the names of the modules, not their machine name. Anyone know how to do that?

3

You can use the system_rebuild_module_data() function to get a list of all module data in the system:

$module_list = system_rebuild_module_data();

Each entry in the array returned from that function contains all the details about the module, e.g.:

screenshot

It's the same function used by the system modules admin page so I think it's safe to assume this is the best way to get this particular data.

  • Awesome. This was exactly the kind of answer I was looking for. Thank you. – James Jun 14 '12 at 19:07
3
$info = system_get_info('module', 'example_module');
if ($info) {
   // Print human-readable name of the module
   print $info['name'];
} else {
   print t("No such module found.");
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.