summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--modules/views_node.inc18
2 files changed, 18 insertions, 1 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 7a982a9..07cbf4d 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -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:
diff --git a/modules/views_node.inc b/modules/views_node.inc
index 3793438..3ec70c5 100644
--- a/modules/views_node.inc
+++ b/modules/views_node.inc
@@ -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',
@@ -888,6 +891,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.
*/
function views_handler_node_nid($fieldinfo, $fielddata, $value, $data) {