知識社群登入
node_invoke_nodeapi()
by 蘇德宙, 2011-04-30 16:21, 人氣(1376)
function node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  $return = array();
  foreach (module_implements('nodeapi') as $name) {
    $function = $name .'_nodeapi';
    $result = $function($node, $op, $a3, $a4);
    if (isset($result) && is_array($result)) {
      $return = array_merge($return, $result);
    }
    else if (isset($result)) {
      $return[] = $result;
    }
  }
  return $return;
}
 
function module_implements() {
  $list = module_list(FALSE, TRUE, $sort);
  foreach ($list as $module) {
    if (module_hook($module, $hook)) {
      $implementations[$hook][] = $module;
    }
  }
  return (array)$implementations[$hook];
}