Skip to content

Instantly share code, notes, and snippets.

@juhasz
Created February 4, 2011 02:29
Show Gist options
  • Save juhasz/810646 to your computer and use it in GitHub Desktop.
Save juhasz/810646 to your computer and use it in GitHub Desktop.
<?php
/**
* Unified node edit/add page template suggestion for Drupal 6.x
* Filename: page-node-edit.tpl.php
* Rearrange the $vars['template_files'] array, put
* 'page-node-edit.tpl.php' to the end of array.
*
* (use this snipet in template.php, at the and of
* 'MYTHEME_preprocess_page' function)
*/
function MYTHEME_preprocess_page(&$vars) {
if (arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit')) {
$edit_page_tpl_key = array_search('page-node-edit', $vars['template_files']);
if ($edit_page_tpl_key !== FALSE) {
unset($vars['template_files'][$edit_page_tpl_key]);
}
$vars['template_files'][] = 'page-node-edit';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment