00001 <?php
00007 class views_handler_field_comment_link_edit extends views_handler_field_comment_link {
00008 function option_definition() {
00009 $options = parent::option_definition();
00010 $options['destination'] = array('default' => FALSE);
00011
00012 return $options;
00013 }
00014
00015 function options_form(&$form, &$form_state) {
00016 parent::options_form($form, $form_state);
00017
00018 $form['destination'] = array(
00019 '#type' => 'checkbox',
00020 '#title' => t('Use destination'),
00021 '#description' => t('Add destination to the link'),
00022 '#default_value' => $this->options['destination'],
00023 '#fieldset' => 'more',
00024 );
00025 }
00026
00027 function render_link($data, $values) {
00028 parent::render_link($data, $values);
00029
00030 $comment = $this->get_value($values);
00031 if (!comment_access('edit', $comment)) {
00032 return;
00033 }
00034
00035 $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
00036 unset($this->options['alter']['fragment']);
00037
00038 if (!empty($this->options['destination'])) {
00039 $this->options['alter']['query'] = drupal_get_destination();
00040 }
00041
00042 $this->options['alter']['path'] = "comment/" . $comment->cid . "/edit";
00043
00044 return $text;
00045 }
00046 }