Commit 16a8304e authored by merlinofchaos's avatar merlinofchaos

#135273: (josh_k) Allow edit handler option to return to view after editing.

parent 25d5a9c8
......@@ -38,6 +38,7 @@ Views 4.7.x-dev
o #115856: Allow use of autocomplete for freetagging taxonomies.
o Allow RSS channel description to be set as part of the argument option.
o New 'tools' page in UI to clear the views cache.
o #135273: (josh_k) Allow 'edit' handler option to return to view after editing.
Views 4.7.x-1.5
Bugs fixed:
......
......@@ -81,7 +81,10 @@ function node_views_tables() {
),
'edit' => array(
'name' => t('Node: Edit link'),
'handler' => 'views_handler_node_edit',
'handler' => array(
'views_handler_node_edit_destination' => t('Return To View'),
'views_handler_node_edit' => t('Return to Node')
),
'notafield' => TRUE,
'addlfields' => array('type', 'uid'),
'option' => 'string',
......@@ -848,6 +851,19 @@ function views_handler_node_edit($fieldinfo, $fielddata, $value, $data) {
}
}
/**
* display a link to edit a node with a destination return
*/
function views_handler_node_edit_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('update', $data)) {
$link_text = $fielddata['options'] ? $fielddata['options'] : t('Edit');
return l($link_text, "node/$data->nid/edit", NULL, drupal_get_destination());
}
}
/**
* display a link to delete a node
*/
......
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