I have been hacking away at event code to
A- not show taxonomy for 'solo' nodes when presenting nodes labeled as 'all'. This was easily done. It is useful because if you make a node not visible in the (all) calendar view (i.e. 'solo' node), why would you want to see the taxonomy for that node? - No problem.

B- only show the taxonomic terms related to the taxonomy (AKA category) used for the selected type (AKA node) view. - Serious difficulties
I am trying to use $curtype to get the currently displayed node name and then grab its taxonomy (unless all is selected of course). This may not be the right approach. Any help would be appreciated.

/**
* Returns a dropdown event taxonomy term input control.
*
* @ingroup event_support.
* @param $curterm The current term id.
* @param $submit Adds 'onChange' form submit javascript command to control.
* @return A form with a dropdown event taxonomy term input control.
*/
function _event_get_taxonomy_control($curterm = NULL, $autosubmit = TRUE) {
  if (module_exist('taxonomy')) {
    $types = event_get_types();
    $vs = array();
      if ($curtype == 'all')  {
        foreach ($types['all'] as $type) {
          $results = taxonomy_get_vocabularies($type);
          foreach ($results as $vocab) {
            $vs[$vocab->vid] = $vocab;
          }
        }
        $results = null;

        $items['all'] = t('(all)');
        foreach ($vs as $vid => $vocab) {
          $tree = taxonomy_get_tree($vid);
          foreach ($tree as $term) {
            $items[$term->tid] = $vocab->name.' - '.$term->name;
          }
        }
      }
      else  { 
        $results = taxonomy_get_vocabularies($curtype);
        foreach ($results as $vocab) {
          $vs[$vocab->vid] = $vocab;
        }

        $results = null;

        $items['all'] = t('(all)');
        foreach ($vs as $vid => $vocab) {
          $tree = taxonomy_get_tree($vid);
          foreach ($tree as $term) {
            $items[$term->tid] = $vocab->name.' - '.$term->name;
          }
        }
      } 
    

    $form['event_term_select'] = array(
      '#type' => 'select',
      '#default_value' => $curterm,
      '#options' => $items,
      '#description' => t('Select event terms to filter by'));
    if ($autosubmit) {
      $form['event_term_select']['#attributes'] = array('onChange'=>'this.form.submit()');
    }

    $form = drupal_get_form('event_taxonomy_filter', $form);

    return theme('event_filter_control', $form);
  }
}

/**
* Returns a dropdown event-enabled content type input control.
*
* @ingroup event_support.
* @param $tid The current term id.

Comments

rubenk’s picture

StatusFileSize
new2.1 KB

Okay. Well. I fixed it. Seems to work by only presenting taxonomy related to selected (i.e. filtered in) node, and in the case of 'all' does not show taxonomy associated with 'solo' nodes. I made this diff but i don't understand the problem with carriage returns.

rubenk’s picture

Version: 5.x-2.x-dev » 4.7.x-1.x-dev
Assigned: Unassigned » rubenk
Priority: Critical » Normal
Status: Active » Needs review
rubenk’s picture

Title: Hacking Event Code to do two things - some minor code help » Only showing taxonomy related to filtered nodes

Changed title for better hits on searches.

rubenk’s picture

Category: support » task

does anybody know how I can fix my line breaks in the diff...I don't think they are compatible with linux for some reason.

rubenk’s picture

StatusFileSize
new1.91 KB

I believe i made a diff with the correct carriage returns. Will someone try this to make sure.

rubenk’s picture

Status: Needs review » Reviewed & tested by the community
rubenk’s picture

Assigned: rubenk » Unassigned

Dumping this because it looks like there is probably no interest.

If it is desired by anyone, then feel free to pick it up.

gerhard killesreiter’s picture

is there any interest by others than rubenk in this patch? otherwise I'll won't ix it.

killes@www.drop.org’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

no interest, apparently