Created
February 4, 2011 02:29
-
-
Save juhasz/810646 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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