• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

modules/aggregator/views_handler_field_aggregator_category.inc

00001 <?php
00002 
00009 class views_handler_field_aggregator_category extends views_handler_field {
00013   function construct() {
00014     parent::construct();
00015     $this->additional_fields['cid'] = 'cid';
00016   }
00017 
00018   function option_definition() {
00019     $options = parent::option_definition();
00020     $options['link_to_category'] = array('default' => FALSE);
00021     return $options;
00022   }
00023 
00027   function options_form(&$form, &$form_state) {
00028     $form['link_to_category'] = array(
00029       '#title' => t('Link this field to its aggregator category page'),
00030       '#description' => t('This will override any other link you have set.'),
00031       '#type' => 'checkbox',
00032       '#default_value' => !empty($this->options['link_to_category']),
00033     );
00034     parent::options_form($form, $form_state);
00035   }
00036 
00042   function render_link($data, $values) {
00043     $cid = $this->get_value($values, 'cid');
00044     if (!empty($this->options['link_to_category']) && !empty($cid) && $data !== NULL && $data !== '') {
00045       $this->options['alter']['make_link'] = TRUE;
00046       $this->options['alter']['path'] = "aggregator/category/$cid";
00047     }
00048     return $data;
00049   }
00050 
00051   function render($values) {
00052     $value = $this->get_value($values);
00053     return $this->render_link($this->sanitize_value($value), $values);
00054   }
00055 }

Generated on Sun Feb 26 2012 12:52:51 for Views by  doxygen 1.7.1