module_implements

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 module_implements($hook, $sort = FALSE, $refresh = FALSE)
drupal7 module_implements($hook, $sort = FALSE)

Determine which modules are implementing a hook.

Übergabeparameter

$hook The name of the hook (e.g. "help" or "menu"). Special cases: MODULE_IMPLEMENTS_CLEAR_CACHE: Force the stored list of hook implementations to be regenerated (such as after enabling a new module, before processing hook_enable). MODULE_IMPLEMENTS_WRITE_CACHE: Write the stored list of hook implementations into the cache_registry table.

$sort By default, modules are ordered by weight and filename. By setting this option to TRUE, modules will be ordered by module name.

Rückgabewert

An array with the names of the modules which are implementing this hook. All enabled modules are taken into consideration and the files containing the implementations are loaded as necessary.

Verwandte Themen

▾ 55 functions call module_implements()

aggregator_admin_form in modules/aggregator/aggregator.admin.inc
Form builder; Configure the aggregator system.
block_form_system_performance_settings_alter in modules/block/block.module
Implementation of hook_form_FORM_ID_alter().
comment_invoke_comment in modules/comment/comment.module
Invoke a hook_comment_[$op]() operation in all modules.
drupal_alter in includes/common.inc
Hands off structured Drupal arrays to type-specific *_alter implementations.
drupal_get_schema in includes/bootstrap.inc
Get the schema definition of a table, or the whole database schema.
drupal_page_footer in includes/common.inc
Perform end-of-request tasks.
element_info in includes/common.inc
Retrieve the default properties for the defined element type.
field_build_modes in modules/field/field.module
Registry of available build modes. TODO : move into hook_fieldable_info() ?
file_load_multiple in includes/file.inc
Load file objects from the database.
filter_list_all in modules/filter/filter.module
Build a list of all filters.
help_links_as_list in modules/help/help.admin.inc
help_menu in modules/help/help.module
Implementation of hook_menu().
menu_get_active_help in includes/menu.inc
Returns the help associated with the active menu item.
menu_router_build in includes/menu.inc
Collect and alter the menu definitions.
module_disable in includes/module.inc
Disable a given set of modules.
module_invoke_all in includes/module.inc
Invoke a hook in all enabled modules that implement it.
node_access_rebuild in modules/node/node.module
Rebuild the node access database. This is occasionally needed by modules that make system-wide changes to access levels.
node_access_view_all_nodes in modules/node/node.module
Determine whether the user has a global viewing grant for all nodes.
node_access_write_grants in modules/node/node.module
This function will write a list of grants to the database, deleting any pre-existing grants. If a realm is provided, it will only delete grants from that realm, but it will always delete a grant from the 'all' realm. Modules which utilize…
node_configure in modules/node/node.admin.inc
Menu callback; presents general node configuration options.
node_load_multiple in modules/node/node.module
Load node objects from the database.
search_admin_settings in modules/search/search.admin.inc
Menu callback; displays the search module settings page.
search_invoke_preprocess in modules/search/search.module
Invokes hook_search_preprocess() in modules.
search_menu in modules/search/search.module
Implementation of hook_menu().
system_get_module_admin_tasks in modules/system/system.module
Generate a list of tasks offered by a specified module.
system_modules in modules/system/system.admin.inc
Menu callback; provides module enable/disable interface.
system_performance_settings in modules/system/system.admin.inc
Form builder; Configure site performance settings.
taxonomy_term_load_multiple in modules/taxonomy/taxonomy.module
Load multiple taxonomy terms based on certain conditions.
taxonomy_vocabulary_load_multiple in modules/taxonomy/taxonomy.module
Load multiple taxonomy vocabularies based on certain conditions.
tearDown in modules/simpletest/drupal_web_test_case.php
Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix.
user_admin_perm in modules/user/user.admin.inc
Menu callback: administer permissions.
user_filters in modules/user/user.module
List user administration filters that can be applied.
user_load_multiple in modules/user/user.module
Load multiple users based on certain conditions.
user_module_invoke in modules/user/user.module
Invokes hook_user() in every module.
watchdog in includes/bootstrap.inc
Log a system message.
_block_rehash in modules/block/block.module
Update the 'block' DB table with the blocks currently exported by modules.
_block_render_blocks in modules/block/block.module
Render the content and subject for a set of blocks.
_db_rewrite_sql in includes/database/database.inc
Helper function for db_rewrite_sql.
_field_attach_create_bundle in modules/field/field.attach.inc
Notify field.module that a new bundle was created.
_field_attach_delete in modules/field/field.attach.inc
Delete field data for an existing object. This deletes all revisions of field data for the object.
_field_attach_delete_bundle in modules/field/field.attach.inc
Notify field.module the a bundle was deleted.
_field_attach_delete_revision in modules/field/field.attach.inc
Delete field data for a single revision of an existing object. The passed object must have a revision id attribute.
_field_attach_form in modules/field/field.attach.inc
Add form elements for all fields for an object to a form structure.
_field_attach_insert in modules/field/field.attach.inc
Save field data for a new object.
_field_attach_load in modules/field/field.attach.inc
Load all fields for the most current version of each of a set of objects of a single object type.
_field_attach_presave in modules/field/field.attach.inc
Perform necessary operations just before fields data get saved.
_field_attach_rename_bundle in modules/field/field.attach.inc
Notify field.module that a bundle was renamed.
_field_attach_submit in modules/field/field.attach.inc
Perform necessary operations on field data submitted by a form.
_field_attach_update in modules/field/field.attach.inc
Save field data for an existing object.
_field_attach_validate in modules/field/field.attach.inc
Perform field validation against the field data in an object.
_field_info_collate_types in modules/field/field.info.inc
Collate all information on field types, widget types and related structures.
_registry_rebuild in includes/registry.inc
_theme_build_registry in includes/theme.inc
Rebuild the theme registry cache.
_user_categories in modules/user/user.module
Retrieve a list of all user setting/information categories and sort them by weight.
_user_forms in modules/user/user.module
Retrieve a list of all form elements for the specified category.

Code

includes/module.inc, line 394

<?php
function module_implements($hook, $sort = FALSE) {
  static $implementations = array(), $sorted_implementations = array(), $loaded = array(), $cached_hooks = 0;

  if (defined('MAINTENANCE_MODE')) {
    return _module_implements_maintenance($hook, $sort);
  }
  if ($hook === MODULE_IMPLEMENTS_CLEAR_CACHE) {
    $implementations = array();
    $sorted_implementations = array();
    $loaded = array();
    $cached_hooks = 0;
    cache_clear_all('hooks', 'cache_registry');
    return;
  }
  if ($hook === MODULE_IMPLEMENTS_WRITE_CACHE) {
    // Only write this to cache if we loaded new implementations.
    if (count($implementations) > $cached_hooks) {
      cache_set('hooks', $implementations, 'cache_registry');
    }
    return;
  }

  if (!isset($loaded[$hook])) {
    if (empty($implementations) && ($cache = cache_get('hooks', 'cache_registry'))) {
      $implementations = $cache->data;
      $cached_hooks = count($implementations);
    }
    if (!isset($implementations[$hook])) {
      $implementations[$hook] = db_query("SELECT module FROM {registry} WHERE type = 'function' AND suffix = :hook ORDER BY weight, module", array(':hook' => $hook))->fetchCol();
    }
    foreach ($implementations[$hook] as $module) {
      $function = $module . '_' . $hook;
      if (!function_exists($function)) {
        drupal_function_exists($function);
      }
    }
    $loaded[$hook] = TRUE;
  }

  if ($sort) {
    if (!isset($sorted_implementations[$hook])) {
      $sorted_implementations[$hook] = $implementations[$hook];
      sort($sorted_implementations[$hook]);
    }
    return $sorted_implementations[$hook];
  }
  else {
    return $implementations[$hook];
  }
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen