Since Mollom doesn't necessarily invoke its hooks on every single page request, it would be nice if integrating modules (D7 or later) could put their mollom hooks into a modulename.mollom.inc due to support from hook_hook_info(). This also helps separate code logically, as well as give a quick indication if a module supports Mollom or not.

Comments

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new5.08 KB

Patch for review. No need for tests since we natively test this with mollom_test.mollom.inc.

sun’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new4.3 KB

Thanks, did a couple of tweaks.

sun’s picture

Status: Reviewed & tested by the community » Postponed
dave reid’s picture

Um, I don't see any reason why it has to wait for that? This is for hooks only and has nothing to do with the generic class.

sun’s picture

I understand. However, this has a low priority currently and the patch affects many lines in mollom_test.module, possibly conflicting with all the REST/class changes, and a big part of the existing mollom_test.module will be moved into a separate mollom_test_server.module.

If time permits, I'll try to commit this change before the next release that's planned to happen in the next days. Overall, however, the plan is to only commit absolutely required changes until the REST/class patch/branch lands, as pretty much every single patch needs to be merged manually into the 7.x-class branch.

sun’s picture

Status: Postponed » Reviewed & tested by the community
StatusFileSize
new944 bytes

Actually, I don't really see why mollom_test module has to move its implementations -- we don't need to test Drupal core functionality.

So here's a revised patch that simply adds hook_hook_info().

sun’s picture

StatusFileSize
new1.65 KB

Added docs for the added hook_mollom_form_list_alter().

dries’s picture

Mmm, hook_hook_info() is normally used to expose a list of triggers that users can assign actions to. Based on the issue description, it sounds like this hook_hook_info() is supposed to do something else?

sun’s picture

This core hook was re-purposed in D7. The original purpose in D6 was very poorly named and only bound to the actions system.

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.

sun’s picture

Status: Reviewed & tested by the community » Fixed

Since this is a best practice for contributed modules in D7, I went ahead and committed this patch to master.

To clarify once more:

hook_hook_info() is in particular useful when a contributed module implements optional support for another contributed module.

This means, if the other module is not installed, then a site would load "dead" support code for another module on every single request, even though the code is and will never be executed.

An actual example would be users of Webform module that do not use Mollom [yet ;)]. Webform currently has to load the support code for Mollom on every site, regardless of whether Mollom is enabled. Now it is able to offload that code into webform.mollom.inc.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 6119228 on master, fai6, 8.x-2.x, fbajs, actions by sun:
    - #1165388 by sun, Dave Reid: Added mollom_hook_info() to offload Mollom...

  • Commit 6119228 on master, fai6, 8.x-2.x, fbajs, actions by sun:
    - #1165388 by sun, Dave Reid: Added mollom_hook_info() to offload Mollom...