Similar as #769136: Taxonomy depth as field, but for Taxonomy Views.
Based on mavimo patch #70 from #769136: Taxonomy depth as field, definition of fields:
--- 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.
Duplicated of: #903438: Let taxonomy views have a Term ID with depth as well #1073170: Taxonomy: Term ID (with depth) : filter on term_node, not on node
Comments
Comment #1
kenorb commentedBased on mavimo patch #70 from #769136: Taxonomy depth as field, definition of fields:
I'm not sure how pre_render should looks like.
Comment #2
kenorb commentedDuplicated of:
#903438: Let taxonomy views have a Term ID with depth as well
#1073170: Taxonomy: Term ID (with depth) : filter on term_node, not on node