Download & Extend

Filter terms by depth inside of "Taxonomy view"

Project:Views
Version:6.x-3.x-dev
Component:taxonomy data
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

Similar as #769136: Taxonomy depth as field,
but for Taxonomy Views.

Comments

#1

Based on mavimo patch #70 from #769136: Taxonomy depth as field, definition of fields:

<?php
--- views_handler_field_taxonomy.inc    (revision 4)
+++
views_handler_field_taxonomy.inc    (working copy)
@@ -
21,6 +21,8 @@
   function
option_definition() {
    
$options = parent::option_definition();
    
$options['link_to_taxonomy'] = array('default' => FALSE);
+   
$options['limit_depth'] = array('default' => FALSE);
+   
$options['limit_depth_value'] = array('default' =>  array());
     return
$options;
   }

@@ -
35,6 +37,23 @@
      
'#type' => 'checkbox',
      
'#default_value' => !empty($this->options['link_to_taxonomy']),
     );
+
+   
$form['limit_depth'] = array(
+     
'#type' => 'checkbox',
+     
'#title' => t('Limit terms by depth'),
+     
'#default_value' => $this->options['limit_depth'],
+    );
+
+   
$form['limit_depth_value'] = array(
+     
'#prefix' => '<div><div id="edit-options-limit-depth-value">',
+     
'#suffix' => '</div></div>',
+     
'#type' => 'checkboxes',
+     
'#title' => t('Display term with depth'),
+     
'#options' => array_combine(range(1, 10), range(1, 10)),
+     
'#default_value' => $this->options['limit_depth_value'],
+     
'#process' => array('expand_checkboxes', 'views_process_dependency'),
+     
'#dependency' => array('edit-options-limit-depth' => array(TRUE)),
+    );
   }

  
/**
@@ -54,6 +73,10 @@
     return $data;
   }

+   function pre_render($values) {
+     /* TODO */
+   }
+
   function
render($values) {
    
$value = $this->get_value($values);
     return
$this->render_link($this->sanitize_value($value), $values);
?>

I'm not sure how pre_render should looks like.

#2

nobody click here