00001 <?php 00007 class views_handler_argument_term_node_tid extends views_handler_argument_many_to_one { 00008 function option_definition() { 00009 $options = parent::option_definition(); 00010 $options['set_breadcrumb'] = array('default' => FALSE); 00011 return $options; 00012 } 00013 00014 function options_form(&$form, &$form_state) { 00015 parent::options_form($form, $form_state); 00016 $form['set_breadcrumb'] = array( 00017 '#type' => 'checkbox', 00018 '#title' => t("Set the breadcrumb for the term parents"), 00019 '#description' => t('If selected, the breadcrumb trail will include all parent terms, each one linking to this view. Note that this only works if just one term was received.'), 00020 '#default_value' => !empty($this->options['set_breadcrumb']), 00021 ); 00022 } 00023 00024 function set_breadcrumb(&$breadcrumb) { 00025 if (empty($this->options['set_breadcrumb']) || !is_numeric($this->argument)) { 00026 return; 00027 } 00028 00029 return views_taxonomy_set_breadcrumb($breadcrumb, $this); 00030 } 00031 00032 function title_query() { 00033 $titles = array(); 00034 $result = db_select('taxonomy_term_data', 'td') 00035 ->fields('td', array('name')) 00036 ->condition('td.tid', $this->value) 00037 ->execute(); 00038 foreach ($result as $term) { 00039 $titles[] = check_plain($term->name); 00040 } 00041 return $titles; 00042 } 00043 }