/[drupal]/contributions/modules/quotes/views_handler_field_quotes.inc
ViewVC logotype

Contents of /contributions/modules/quotes/views_handler_field_quotes.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Fri Aug 28 16:28:01 2009 UTC (2 months, 3 weeks ago) by nancyw
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-7--1
Changes since 1.1: +57 -0 lines
File MIME type: text/x-php
Replacing HEAD to begin 7.x
1 <?php
2 // $Id: views_handler_field_quotes.inc,v 1.1.2.1 2009/02/19 06:05:06 nancyw Exp $
3 /**
4 * @file
5 * Provide views data and handlers for quotes.module
6 */
7
8 /**
9 * Field handler to provide an embedded image.
10 *
11 * @ingroup views_field_handlers
12 */
13 class views_handler_field_quotes extends views_handler_field {
14 /**
15 * Define options available for this field.
16 */
17 function option_definition() {
18 $options = parent::option_definition();
19 $options['author_link'] = array('default' => 'text');
20 return $options;
21 } /* */
22
23 /**
24 * Build option configuration form.
25 */
26 function options_form(&$form, &$form_state) {
27 parent::options_form($form, $form_state);
28
29 $form['author_link'] = array(
30 '#title' => t('Show author as'),
31 '#type' => 'radios',
32 '#options' => array(
33 'text' => 'Text',
34 'author' => 'Link to quotes',
35 ),
36 '#default_value' => $this->options['author_link'],
37 );
38 } /* */
39
40 /**
41 * Render field output to the browser.
42 */
43 function render($values) {
44 // drupal_set_message(print_r($values, true));
45 $author = $values->{$this->field_alias};
46 $type = $this->options['author_link'];
47 // drupal_set_message("\$this->field_alias='$this->field_alias', author='$author', type='$type'.");
48
49 switch ($type) {
50 case 'author':
51 return l($author, 'quotes/author/' . check_plain($author), array('attributes' => array('rel' => 'tag')));
52
53 default: // Also 'text'
54 return check_plain($author);
55 }
56 }
57 } /* */

  ViewVC Help
Powered by ViewVC 1.1.2