More specific way to override THEME_process_page() function? I'm going to explain my problem through the use of pseudo code.  Right now, i have in template.php the following code

function THEME_process_page(&amp;$variables)
{
    if($variables-&gt;view == 'calendar')
    {
        // do something
    }
    else if ($variables-&gt;view == 'google_maps')
    {
        // do something
    }
    else if($variables-&gt;content_type == 'news')
    {
        // do something
    }
    else if($variables-&gt;content_type == 'event')
    {
        // do something
    }
}


Instead of writing a whole bunch of if statements for each view and content_type, can I do something like

function THEME_process_view_calendar()
{
    // do something
}
function THEME_process_view_google_maps()
{
    // do something
}
function THEME_process_content_type_news()
{
    // do something
}
function THEME_process_content_type_event()
{
    // do something
}


If this is possible, what's the correct way of naming functions to do this?
In the case of the content types, Drupal invokes only the preprocess and process functions for the page; it doesn't invoke a different preprocess function basing on the content type of the node being shown. Drupal invokes the following functions (the same order is followed for the process functions):


template_preprocess(&amp;$variables, $hook)
template_preprocess_page(&amp;$variables)
MODULE_preprocess(&amp;$variables, $hook)
MODULE_preprocess_page(&amp;$variables)
ENGINE_engine_preprocess(&amp;$variables, $hook)
ENGINE_engine_preprocess_page(&amp;$variables)
ENGINE_preprocess(&amp;$variables, $hook)
ENGINE_preprocess_page(&amp;$variables)
THEME_preprocess(&amp;$variables, $hook)
THEME_preprocess_page(&amp;$variables)


"MODULE" is the short name of a module, "ENGINE" is the short name of the theme engine used for the currently used theme, and "THEME" is the short name for the currently set theme.

You could say to Drupal to call different preprocess functions, but the hook that would add them doesn't have information about the content type of the node being shown. hook_theme_registry_alter() could be used to add new preprocess functions to a theme function, but all the preprocess function added would be all executed.

function mymodule_theme_registry_alter(&amp;$theme_registry) {
  if (isset($theme_registry['page']) {
    $theme_registry['page']['preprocess functions'][] = 'template_mymodule_additional_preprocess_handler';
    $theme_registry['page']['preprocess functions'][] = 'template_mymodule_last_preprocess_handler';
  } 
}


This is only necessary if the preprocess function is not one of the functions that Drupal would invoke.

If you need to use a different template file basing on the content type, then a preprocess function can suggest the template files to use; in Drupal 7, this means to use code similar to the following one:

function mymodule_preprocess_page(&amp;variables) {
  if (!empty($variables['node']) {
    $variables['theme_hook_suggestions'][] = "page__" . str_replace(array("/", "\\", "\0", '-'), array('', '', '', '_'), $variables['node']-&gt;type);
  }
}