Hi, everybody.

I was working with the Webform module with special software requirements:

  1. Get published taxonomy terms in a select.
  2. Avoid using module development from zero.

So I used 2 more modules:

  1. Webform Term Options: To get a set of taxonomy temrs and
  2. Taxonomy Tools: to get taxonomy terms filtered by Taxonomy Publisher Filter submodule activation.

But, when I retrieve taxonomy terms on a select in webform I got published and unpublished terms.

Solving this problem was pretty simple, I just modified /sites/all/modules/webform_term_opts/webform_term_opts.module and remplaced webform_term_options_vocabulary_terms function as follows:

function webform_term_options_vocabulary_terms($component, $flat, $vid) {
  $terms = array();

  //previous version without using filters
  //$tree = taxonomy_get_tree($vid);
  /**
   * @todo Do something for hierarchical vocabularies here (hint: use $flat arg)
   */
  /*foreach ($tree as $term) {
    $terms['tid_' . $term->tid] = $term->name;
  }*/

  //Actual version using taxonomy terms filter module from taxonomy tools
  $tree = _taxonomy_publisher_filter_custom_form($vid);

  foreach ($tree as $key => $value) {
    $terms['tid_' . $key] = $value;
  }
  
  return $terms;
}

Following https://www.drupal.org/node/1895610 community documentation.

Hope it help y'all.

Bye.

Comments

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

JoAMoS’s picture

Issue summary: View changes

Minor Correction: Changed Link name from (wrong) Webform Tools to (correct) Taxonomy Tools.