Code Snippets

Creating templates and pre-processors for views in module

Here's a snippet that will allow you to create templates and pre-processors easily:

/**  * Implementation of hook_theme  */ function MODULE_NAME_theme($existing, $type, $theme, $path) {   $themes['views_view_field__field_blog_blogger_nid_nid'] =     array(     'arguments' => array('view' => NULL, 'field' => NULL, 'row' => NULL),     'template' => 'views-view-field--field-blog-blogger-nid-nid',     'path' => $path .'/templates',     'original hook' => 'views_view_field',     'preprocess functions' => array(       'MODULE_NAME_preprocess_views_view_field__field_blog_blogger_nid_nid',     ),   );   return $themes; }

If you need any more information, refer to this blog post.

 

 

Resource Tags: