You are here

function data_node_remove_page in Data 6

Page callback for removing.

@todo: add tokenizing drupal_valid_token/drupal_get_token to prevent XSS

1 string reference to 'data_node_remove_page'
data_node_menu in data_node/data_node.module
Implementation of hook_menu().

File

data_node/data_node.module, line 283
Hooks and API functions for Data Node module.

Code

function data_node_remove_page($table, $id, $nid, $token) {
  if (drupal_valid_token($token, _data_node_hash($table, $id, $nid))) {
    data_node_remove($table, $id, $nid);
  }

  // Handle AJAX requests
  if (isset($_GET['ajax'])) {
    $response = array(
      'status' => TRUE,
      'table' => $table
        ->get('name'),
      'id' => $id,
      'nid' => $nid,
      'labels' => data_node_render_labels($table, $id),
      'add_link' => data_node_render_remove_link($table, $id, $nid),
      'remove_link' => data_node_render_add_link($table, $id, $nid),
    );
    drupal_json($response);
    exit;
  }
  drupal_goto($_GET['q']);
}