I am trying to change the URL of the node edit link for a specific view. This is what I have done and it (almost) works:
- created a file mymodule/views/mymodule.views.inc with the following code:
/** * Implements hook_views_data_alter(). */ function kd_ari_views_data_alter(&$data) { module_load_include('inc', 'mymodule', 'views/views_handler_field_article_link_edit'); $data['views_entity_node']['edit_node']['field']['handler'] = 'views_handler_field_article_link_edit'; }
- created a second file mymodule/views/views_handler_field_article_link_edit.inc with the following code:
class views_handler_field_article_link_edit extends views_handler_field_node_link { function render_link($node, $values) { if (!node_access('update', $node)) { return; } $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = 'admin/mymodule/' . $node->nid; $text = !empty($this->options['text']) ? $this->options['text'] : t('edit'); return $text; } }
The problem is that the view displays the edit link only one time after I clear all caches... afterwards the display link is gone. Any tips would be highly appreciated.
admin/mymodule/[nid]
path?