You are here

function slickgrid_callback in Slickgrid 7

Same name and namespace in other branches
  1. 6 slickgrid.callbacks.inc \slickgrid_callback()

hook_menu callback; Universal json callback - builds function name and returns error = true

1 string reference to 'slickgrid_callback'
slickgrid_menu in ./slickgrid.module
Implementation of hook_menu().

File

includes/slickgrid.callbacks.inc, line 7

Code

function slickgrid_callback($op) {
  $func = 'slickgrid_callback_' . $op;

  // Get any additonal arguments passed to the callback function & shift off the first one (the $op)
  $args = func_get_args();
  array_shift($args);

  // Basic required json
  $json = array(
    'status' => TRUE,
    'op' => $op,
  );

  // The callback can append extra json
  if (is_array($additonal_json = call_user_func_array($func, $args))) {
    $json += $additonal_json;
  }
  slickgrid_callback_get_messages($json);

  // Return the json
  drupal_json_output($json);
}