Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I need to add the following code as a preprocess function. I can add it verbatim to template.php and it works just perfectly. However, it appears that the preferred way of handling this in Omega is to create a preprocess-xxx.inc file and include the function there. But I'm stuck.
Do I create preprocess-html.inc, preprocess-page.inc, preprocess-node.inc?
And what do I include in that file?
Here's the code:
function YOURTHEME_preprocess_html (&$vars) {
if (module_exists('path')) {
$alias = drupal_get_path_alias(str_replace('/edit','',$_GET['q']));
if ($alias != $_GET['q']) {
$template_filename = 'html';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '__' . $path_part;
$vars['theme_hook_suggestions'][] = $template_filename;
}
}
}
}
The purpose of the code is to load a custom html--nodealias.tpl.php file so that I can add code to the head and prior to the closing body tags.
Comments
Comment #1
Cellar Door CreditAttribution: Cellar Door commentedIf you want to add code to the head and closing why not just copy/paste the html.tpl.php from the core omega/templates into your subtheme/templates you can add the code you want to there and not have to mess w/ the preprocess functions.
Comment #2
Cellar Door CreditAttribution: Cellar Door commentedComment #3
Cellar Door CreditAttribution: Cellar Door commentedsorry wrong post..... if you still want help w/ a preprocess function let us know. Otherwise you can declare fixed yourself