module_exists

5 module.inc module_exists($module)
6 module.inc module_exists($module)
7 module.inc module_exists($module)
8 module.inc module_exists($module)

Determine whether a given module exists.

Parameters

$module: The name of the module (without the .module extension).

Return value

TRUE if the module is both installed and enabled.

31 calls to module_exists()

File

includes/module.inc, line 243
API for loading and interacting with Drupal modules.

Code

function module_exists($module) {
  $list = module_list();
  return array_key_exists($module, $list);
}

Comments

see also the related php function: function_exists()

Another similar check which can be helpful is PHP's own function_exists()
Check its documentation here:
http://www.php.net/manual/en/function.function-exists.php

Dave Shaw
Tribe Rising

Login or register to post comments