taxonomy

Enable WYSIWYG for term descriptions?

  1. function my_module_form_alter(&$form, $form_state, $form_id) {
  2.    
  3.     switch ($form_id) {
  4.                
  5.           case 'taxonomy_form_term':
  6.             $form['description']['#WYSIWYG'] = TRUE;
  7.                 break;
  8.     }  //switc

Fix for Remove 'Vocabularies' fieldset

  1. /**
  2.  * Implementation of hook_form_alter().
  3.  */
  4. function mymodule_form_alter(&$form, &$form_state, $form_id) {
  5.   if ($form_id == 'nodetype_node_form') {
  6.     // Remove 'Vocabularies' fieldset.
  7.  

Remove 'Vocabularies' fieldset

  1. /**
  2.  * Implementation of hook_form_alter().
  3.  */
  4. function mymodule_form_alter(&$form, &$form_state, $form_id) {
  5.   if ($form_id == 'mobileapp_node_form') {
  6.     // Remove 'Vocabularies' fieldset.
  7.  

Code for Taxonomy Synonym Token

  1. $newarray = array_merge($node->taxonomy, array());
  2. $synonym = taxonomy_get_synonyms($newarray[0]->tid);
  3. return $synonym[0];

Theme function to render a Taxonomy tree as nested lists

  1. function theme_taxonomy_tree($vid) {
  2.   $terms = taxonomy_get_tree($vid);
  3.   $tree = array();
  4.   $items = array();
  5.   foreach($terms as $term) {
  6.     $items[$term->tid]['data'] = theme('term_in_tree', $term);
  7.     $tree[$term->tid] =& $items[$term->tid];
  8.     foreach($term->parents as $parent_tid) {
  9.       if($parent_tid != 0) {
  10.         unset($tree[$term->tid]);
  11.         $items[$parent_tid]['children'][$term->tid] =& $items[$term->tid];
  12.       }
  13.     }
  14.   }
  15.   return theme('item_list', array_values($tree));
  16. }

arsing stupid taxonomy caching bollocks, wtf?!

  1.         // existing article, we only need to add category
  2.         $existing_story_node = node_load($result, NULL, TRUE);
  3.        
  4.         // prepare categories, loading existing taxonomy data first

Filter nodes by a taxonomy_content field with view argument accepting terms names and synonyms

  1. /**
  2.  * The following code is used as validator for a view argument to filter nodes having the passed
  3.  * term as value for a taxonomy_content field.

Fix for Setting view title when using a custom validator for a taxonomy_content field

  1. /**
  2.  * The previous code is the export of a view display which add a argument to filter nodes having a the passed term using name and synonyms
  3.  * as value for a taxonomy_content field.

Setting view title when using a custom validator for a taxonomy_content field

  1. $handler->override_option('arguments', array(
  2.   'field_category_value' => array(
  3.     'default_action' => 'not found',
  4.     'style_plugin' => 'default_summary',
  5.     'style_options' => array(),
  6.    

Change the ImageCache presets used to display an ImageField in node teaser according to a Taxonomy field

  1. /**
  2.  * Change the ImageCache presets used to display an ImageField in node teaser according to a Taxonomy field.
  3.  * The change is made in an implementation of hook_nodeapi()
  4.  * A term is used to trigger preset changes. The trigger is identified by a specific synonym.
  5.  */
Syndicate content