I have a couple of questions on Drupal coding conventions that I haven't been able to gleam from the docs or the code.
Outside of knowing the name of every hook in Drupal, is there a way to differentiate a function that implements a hook from a function that's just providing a bit of functionality for a hook? Either something enforced via code or some convention?
Second, possibly related question. After reviewing the core modules, I've noticed that some functions are named with a leading underscore
function _node_rankings(SelectQueryExtender $query) {
...
}
What meaning is attached to the underscore? My assumption it's mimicking a "protected" convention, meaning that it should only be called from other functions in the node.module
file; however, I couldn't find anything to confirm this.
I know about the Coding Standards, but they seem aimed at general PHP syntax, not conventions aimed at Drupal's internal systems.
In answer to your first question, if you look at the code of most modules, the comments above hook implementations will typically say:
After working with Drupal a while, you'll start to recognize the most common hooks.