| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: image_handler_relationship_node_image_file.inc,v 1.1 2009/05/01 22:29:47 sun Exp $ 3 4 /** 5 * @file 6 * Views relationship handler for image size filter. 7 */ 8 9 class image_handler_relationship_node_image_file extends views_handler_relationship { 10 11 function option_definition() { 12 $options = parent::option_definition(); 13 $options['image_size'] = array('default' => IMAGE_THUMBNAIL); 14 return $options; 15 } 16 17 function options_form(&$form, &$form_state) { 18 parent::options_form($form, $form_state); 19 20 $image_size_options = array(); 21 foreach (image_get_sizes() as $key => $size) { 22 $image_size_options[$key] = $size['label']; 23 } 24 25 $form['image_size'] = array( 26 '#type' => 'select', 27 '#title' => t('Image sizes'), 28 '#options' => $image_size_options, 29 '#default_value' => $this->options['image_size'], 30 '#multiple' => TRUE, 31 '#description' => t('Which image sizes to join on. You can select none (to include all sizes), one, or multiple; Every size will introduce a new row. Example: If the result are 5 image nodes and you selected 2 sizes; The result will be 10 rows. There is no fallback; if a size does not exist (because the original is smaller) then no data will be obtained.'), 32 ); 33 } 34 35 function ensure_my_table() { 36 if (!isset($this->table_alias)) { 37 $join = $this->get_join(); 38 39 // Adjust the join for the selected image size. 40 if (!empty($this->options['image_size'])) { 41 $join->extra[] = array( 42 'field' => 'image_size', 43 'value' => $this->options['image_size'], 44 ); 45 } 46 $this->table_alias = $this->query->add_table($this->table, $this->relationship, $join); 47 } 48 return $this->table_alias; 49 } 50 } 51
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |