5 * Definition of views_handler_field_comment_link_edit.
9 * Field handler to present a link node edit.
11 * @ingroup views_field_handlers
13 class views_handler_field_comment_link_edit extends views_handler_field_comment_link {
14 function option_definition() {
15 $options = parent::option_definition();
16 $options['destination'] = array('default' => FALSE, 'bool' => TRUE);
21 function options_form(&$form, &$form_state) {
22 parent::options_form($form, $form_state);
24 $form['destination'] = array(
25 '#type' => 'checkbox',
26 '#title' => t('Use destination'),
27 '#description' => t('Add destination to the link'),
28 '#default_value' => $this->options['destination'],
29 '#fieldset' => 'more',
33 function render_link($data, $values) {
34 parent::render_link($data, $values);
35 // ensure user has access to edit this comment.
36 $comment = $this->get_value($values);
37 if (!comment_access('edit', $comment)) {
41 $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
42 unset($this->options['alter']['fragment']);
44 if (!empty($this->options['destination'])) {
45 $this->options['alter']['query'] = drupal_get_destination();
48 $this->options['alter']['path'] = "comment/" . $comment->cid . "/edit";