mongolito404

Theming views field in your module

  1. /**
  2.  * Implementation of hook_theme()
  3.  */
  4. function MODULE_theme($existing) {
  5.   return array(
  6.     //works, views-view--viewname--page.tpl.php is used
  7.     'views_view__viewname__page' => array(
  8.  

FeedsNodeRemover

  1. <?php
  2. class FeedsNodeRemover extends FeedsProcessor {
  3.  
  4.   /**
  5.    * Process the result of the parser or previous processors.
  6.    *
  7.    * @todo Add a config entry for the mapping sources/targets to

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. }

Hide title for pages in the primary links menu

  1. /**
  2.  * Hide the title of the page if there is an entry for its path in the primary-menu (at any depth).
  3.  * Usefull when primary links use huge font, to avoid repeating the same information on screen.
  4.  *

Creating a node with a FileField from file

  1. /**
  2.  * The following code create a node with a fieldfield attached file.

Creating a node with a FileField from file

  1. /**
  2.  * FileField creation code from http://drupal.org/node/292904#comment-956155
  3.  */
  4. function import_document(&$document){
  5.   $node = new stdClass();
  6.   $node->type = 'folder';
  7.   node_object_prepa

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