Invokes a hook in all enabled modules that implement it.
All arguments are passed by value. Use drupal_alter() if you need to pass arguments by reference.
as of Drupal 8.0. Use Drupal::moduleHandler()->invokeAll($hook).
\Drupal\Core\Extension\ModuleHandler::invokeAll()
function module_invoke_all($hook) {
$args = func_get_args();
// Remove $hook from the arguments.
array_shift($args);
return Drupal::moduleHandler()
->invokeAll($hook, $args);
}