I think it would be good to implement hook_hook_info() and assign the hooks to a group so that other modules can put their hooks inside a separate include file that will only get loaded when Search API hooks are being called:

group: A string defining the group to which the hook belongs. The module system will determine whether a file with the name $module.$group.inc exists, and automatically load it when required.

Comments

andrewbelcher’s picture

Here's a bash at it. This just declares everything that is in search_api.api.php...

andrewbelcher’s picture

Status: Active » Needs review
rlmumford’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me. You could use an array of strings and then a foreach to set them as the keys for the $hooks array. This would mean that the 'group' => 'search_api' line would only be written once. I think the way it's written is more readable though.

This is a really helpful patch as the less code is in a modules .module file the less code needs to be bootstrapped on each page load improving performance. It also makes it easier to manage the code on a site.

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +Backwards compatible API change

Great idea, thanks! Thanks also for the patch, works perfectly.
Committed.
I just reformatted it a bit and added a note to the README.txt.

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