You are here

function _devel_node_access_module_invoke_all in Devel 7

Same name and namespace in other branches
  1. 5 devel_node_access.module \_devel_node_access_module_invoke_all()
  2. 6 devel_node_access.module \_devel_node_access_module_invoke_all()

Invokes a hook.

Return value

The results of the hook invocation keyed by the machine name of the implementing module.

1 call to _devel_node_access_module_invoke_all()
devel_node_access_block_view in ./devel_node_access.module
Implements hook_block_view().

File

./devel_node_access.module, line 284
Functions for debugging node access permissions.

Code

function _devel_node_access_module_invoke_all() {

  // array and scalar returns
  $args = func_get_args();
  $hook = $args[0];
  unset($args[0]);
  $return = array();
  foreach (module_implements($hook) as $module) {
    $function = $module . '_' . $hook;
    if (function_exists($function)) {
      $result = call_user_func_array($function, $args);
      if (isset($result)) {
        if (is_array($result)) {
          foreach ($result as $key => $value) {

            // Add name of module that returned the value.
            $result[$key]['#module'] = $module;
          }
        }
        else {

          // Build array with result keyed by $module.
          $result = array(
            $module => $result,
          );
        }
        $return = array_merge_recursive($return, $result);
      }
    }
  }
  return $return;
}