title: Preprocess node from a module: not getting same vars as template.php
body: <p>I'd like to preprocess and theme my nodes from a module instead of template.php.  Before, I'd have a giant switch statement in <code>theme_preprocess_node()</code>.  But this only ever applied to my primary tab - subtabs were being templated from the modules they were defined in.  So I like the idea of consolidating all my preprocess functions and templates into one organized module.</p>
  
  <p>The structure I want is essentially like this (pulling out details for a summary):</p>
  
  <pre><code>function foomodule_menu()
  {
      $items['foo/%node'] = array(
          'page callback' =&gt; 'page_foo_overview',
          'page arguments' =&gt; array(1),
          'type' =&gt; MENU_NORMAL_ITEM,
      );
          $items['foo/%node/overview'] = array(
              'type' =&gt; MENU_DEFAULT_LOCAL_TASK,
          );
          $items['foo/%node/details'] = array(
              'page callback' =&gt; 'page_foo_details',
              'page arguments' =&gt; array(1),
              'type' =&gt; MENU_LOCAL_TASK,
          );
  }
  
  function foomodule_theme()
  {
      return array(
          'page_foo_overview' =&gt; array(
              'arguments' =&gt; array('node' =&gt; NULL),
              'template' =&gt; 'templates/page-foo-overview'
          ),
          'page_foo_details' =&gt; array(
              'arguments' =&gt; array('node' =&gt; NULL),
              'template' =&gt; 'templates/page-foo-details'
          ),
      );
  }
  
  function page_foo_overview($node)
  {
      // Used to do this, and themed it from template.php
      // return node_view($node, FALSE, TRUE);
  
      // Instead, I'd like to theme all pages directly in this module:
      return theme('page_foo_overview', $node);
  }
  
  function template_preprocess_page_foo_overview(&amp;$vars)
  {
      // But $vars doesn't contain the same data as when I themed from template.php
      // Specifically the ['view'] element of CKK fields, and flags like $teaser
      // What do I need to do to get at the same data?
      dsm($vars);
  }
  </code></pre>
  
  <p>All works great, but the $vars available in my preprocess are not what I'm used to in the template.php's <code>theme_preprocess_node()</code> function.  For one, it looks like CCK fields haven't been run through <code>content_format()</code> (no ['view'] element), and flags like <code>teaser</code> and <code>page</code> are missing.</p>
  
  <p>What's being called before <code>theme_preprocess_node()</code> that I could invoke here?</p>
  
  <p>Am I asking for trouble by doing this?  It makes so much more sense to me to have it organized like this and be in control of each step: menu > page callback > theme > preprocess > template, and to be able to organize this across multiple modules as I see fit.</p>