hook_hook_info() allows modules that "own" a hook to specify that other modules may put the hook implementations into include files that are loaded on demand.

This especially makes sense for hook_content_migrate_*() hooks, which are needed once only.

You can see an optimized implementation of hook_hook_info() in #1165388-7: Add mollom_hook_info() to offload Mollom hooks into modulename.mollom.inc:

 /**
+ * Implements hook_hook_info().
+ */
+function mollom_hook_info() {
+  $hooks = array(
+    'mollom_form_list',
+    'mollom_form_list_alter',
+    'mollom_form_info',
+    'mollom_form_info_alter',
+    'mollom_form_insert',
+    'mollom_form_update',
+    'mollom_form_delete',
+    'mollom_data_insert',
+    'mollom_data_update',
+    'mollom_data_delete',
+  );
+  $hooks = array_fill_keys($hooks, array(
+    'group' => 'mollom',
+  ));
+  return $hooks;
+}
CommentFileSizeAuthor
#2 cck.hook-info.2.patch767 bytessun
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Priority: Normal » Major
Issue tags: +Performance

Third-party modules need to implement these hooks, and they are dead code after migration, but yet, the code is loaded on all requests for no benefit.

sun’s picture

Status: Active » Needs review
FileSize
767 bytes

Attached patch allows modules to implement the alter hooks in

$module.content_migrate.inc

DamienMcKenna’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Issue summary: View changes
Parent issue: » #1277262: Plan for CCK 7.x-3.0 release