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(&$variables, $hook)
- template_preprocess_page(&$variables)
- MODULE_preprocess(&$variables, $hook)
- MODULE_preprocess_page(&$variables)
- ENGINE_engine_preprocess(&$variables, $hook)
- ENGINE_engine_preprocess_page(&$variables)
- ENGINE_preprocess(&$variables, $hook)
- ENGINE_preprocess_page(&$variables)
- THEME_preprocess(&$variables, $hook)
- THEME_preprocess_page(&$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(&$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(&variables) {
if (!empty($variables['node']) {
$variables['theme_hook_suggestions'][] = "page__" . str_replace(array("/", "\\", "\0", '-'), array('', '', '', '_'), $variables['node']->type);
}
}