Commit 84b50489 authored by merlinofchaos's avatar merlinofchaos

#138481: (fago) Allow 'delete' link to return to view like edit link does.

parent ec71310d
......@@ -10,6 +10,7 @@ Views 5.x-dev
o #117365: Comment: Last Changed Time wasn't ensuring node_comment_statistics is in the query.
o #136794: Sort by nid via click-sorting was also broken
o #141205: (by mfrederickson) Add an argument to views_get_filter_values() to let other code use it.
o #138481: (fago) Allow 'delete' link to return to view like edit link does.
Views 5.x-beta3
Bugs fixed:
......
......@@ -95,7 +95,10 @@ function node_views_tables() {
),
'delete' => array(
'name' => t('Node: Delete link'),
'handler' => 'views_handler_node_delete',
'handler' => array(
'views_handler_node_delete_destination' => t('Return To View'),
'views_handler_node_delete' => t('Return To The Frontpage'),
),
'notafield' => TRUE,
'addlfields' => array('type', 'uid'),
'option' => 'string',
......@@ -887,6 +890,19 @@ function views_handler_node_delete($fieldinfo, $fielddata, $value, $data) {
}
}
/**
* display a link to delete a node with a destination return
*/
function views_handler_node_delete_destination($fieldinfo, $fielddata, $value, $data) {
// try to build a fake node object
$data->type = $data->node_type;
$data->uid = $data->node_uid;
if (node_access('delete', $data)) {
$link_text = $fielddata['options'] ? $fielddata['options'] : t('Delete');
return l($link_text, "node/$data->nid/delete", NULL, drupal_get_destination());
}
}
/**
* Display a node's nid, which is a little bit special.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment