Same name and namespace in other branches
  1. 5.x includes/module.inc \module_exists()
  2. 6.x includes/module.inc \module_exists()

Determines whether a given module exists.

Parameters

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

Return value

bool TRUE if the module is both installed and enabled, FALSE otherwise.

30 calls to module_exists()
BlockTestCase::testBlockRehash in modules/block/block.test
Test _block_rehash().
block_block_list_alter in modules/block/block.module
Implements hook_block_list_alter().
CommentFieldsTest::testCommentEnable in modules/comment/comment.test
Test that comment module works when enabled after a content module.
DashboardBlocksTestCase::testDisableEnable in modules/dashboard/dashboard.test
Tests that the dashboard module can be re-enabled, retaining its blocks.
form_test_menu in modules/simpletest/tests/form_test.module
Implements hook_menu().

... See full list

File

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

Code

function module_exists($module) {
  $list = module_list();
  return isset($list[$module]);
}