~spreadubuntu/spreadubuntu/devel-drupal6

« back to all changes in this revision

Viewing changes to modules/views/modules/aggregator/views_handler_field_aggregator_title_link.inc

  • Committer: ruben
  • Date: 2009-06-08 09:38:49 UTC
  • Revision ID: ruben@captive-20090608093849-s1qtsyctv2vwp1x1
SpreadUbuntu moving to Drupal6. Based on ubuntu-drupal theme and adding our modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
// $Id: views_handler_field_aggregator_title_link.inc,v 1.1 2009/01/07 19:38:08 merlinofchaos Exp $
 
3
 
 
4
 /**
 
5
 * Field handler that turns an item's title into a clickable link to the original
 
6
 * source article.
 
7
 */
 
8
class views_handler_field_aggregator_title_link extends views_handler_field {
 
9
  function construct() {
 
10
    parent::construct();
 
11
    $this->additional_fields['link'] = 'link';
 
12
  }
 
13
 
 
14
  function option_definition() {
 
15
    $options = parent::option_definition();
 
16
 
 
17
    $options['display_as_link'] = array('default' => TRUE);
 
18
 
 
19
    return $options;
 
20
  }
 
21
 
 
22
  /**
 
23
   * Provide link to the page being visited.
 
24
   */
 
25
  function options_form(&$form, &$form_state) {
 
26
    parent::options_form($form, $form_state);
 
27
    $form['display_as_link'] = array(
 
28
      '#title' => t('Display as link'),
 
29
      '#type' => 'checkbox',
 
30
      '#default_value' => !empty($this->options['display_as_link']),
 
31
    );
 
32
  }
 
33
 
 
34
  function render($values) {
 
35
    $value = $values->{$this->field_alias};
 
36
    $link = $values->{$this->table_alias . '_link'};
 
37
    if (!empty($this->options['display_as_link'])) {
 
38
      return l(check_plain($value), $link, array('html' => TRUE));
 
39
    }
 
40
    else {
 
41
      return $value;
 
42
    }
 
43
  }
 
44
}
 
 
b'\\ No newline at end of file'