/[drupal]/contributions/modules/nodeblock/nodeblock.module
ViewVC logotype

Diff of /contributions/modules/nodeblock/nodeblock.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.10, Thu Feb 5 20:00:12 2009 UTC revision 1.11, Wed Apr 1 03:12:10 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: nodeblock.module,v 1.8 2009/01/30 19:36:41 rz Exp $  // $Id: nodeblock.module,v 1.10 2009/02/05 20:00:12 rz Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 118  function nodeblock_block($op = 'list', $ Line 118  function nodeblock_block($op = 'list', $
118        // otherwise we just use the main node        // otherwise we just use the main node
119      }      }
120    
121        // Set a flag so that themes have more context.
122        $node->nodeblock = TRUE;
123    
124      $block['subject'] = $node->title;      $block['subject'] = $node->title;
125      // using page arg = TRUE since we want the full content (generally speaking)      $block['content'] = node_view($node, FALSE, FALSE, TRUE);
     $block['content'] = node_view($node, FALSE, TRUE, TRUE);  
126    
127      return $block;      return $block;
128    }    }
# Line 158  function nodeblock_link($type, $node = N Line 160  function nodeblock_link($type, $node = N
160    
161    return $links;    return $links;
162  }  }
163    
164    /**
165     * Implementation of hook_preprocess_node().
166     *
167     * Add node-nodeblock-default to the suggested theme files for all nodeblock
168     * enabled nodes. Note that the template is "unshifted" onto the template files
169     * array. This gives the template file a lower priority than any node-nodetype
170     * templates, but a higher priority than a generic node.tpl.php.
171     */
172    function nodeblock_preprocess_node(&$variables) {
173      if ($variables['node']->nodeblock) {
174        array_unshift($variables['template_files'], 'node-nodeblock-default');
175      }
176    }
177    
178    /**
179     * Implementation of hook_theme_registry_alter().
180     *
181     * Add nodeblock path to the 'theme paths' for the 'node' hook.  This allows us
182     * to use node-nodeblock-default.tpl.php from the module directory. Note that
183     * the path is "unshifted" onto the theme paths array. This puts the module path
184     * before the modules/node path, but since neither of these modules implements
185     * the same templates, there is not problem.
186     */
187    function nodeblock_theme_registry_alter(&$registry) {
188      array_unshift($registry['node']['theme paths'], drupal_get_path('module', 'nodeblock'));
189    }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.2