function npop_ajax_close_npop in Node pop-up 7
Close button callback function.
Return value
array Commands of ajax interface.
1 string reference to 'npop_ajax_close_npop'
- npop_menu in ./
npop.module - Implements hook_menu().
File
- ./
npop.module, line 179 - Create popup nodes with ajax and Drupal core functionality.
Code
function npop_ajax_close_npop() {
$query = drupal_get_query_parameters();
// Check url GET parameter for changing back page url.
$url = empty($query['url']) ? '/' : check_plain($query['url']);
// Check ID GET parameter for closing on of the multiple opened popup nodes.
$id = empty($query['id']) ? 0 : $query['id'];
if ($id) {
$selector = '#npop-' . $id;
$node = node_load($id);
$has_change_url = npop_check_change_url($node->type);
}
else {
$selector = '.npop';
$has_change_url = isset($query['url']);
}
$commands = array();
if ($has_change_url) {
$commands[] = array(
'command' => 'npop_change_url',
'url' => $url,
);
}
$commands[] = ajax_command_invoke('body', 'removeClass', array(
'npop-over',
));
$commands[] = ajax_command_remove($selector);
// Allow other modules alter commands on closing window.
drupal_alter('npop_ajax_close', $commands);
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}