filename; $subtheme_path = str_replace('page.tpl.php', 'style.css', $themes[$theme]->filename); db_query("UPDATE {system} SET description='%s', filename='%s' WHERE name='%s'", $parent_path, $subtheme_path, $theme); // Refresh Drupal internals. $theme = $base_theme; $themes = list_themes(TRUE); } $theme_path = dirname($themes[$theme_key]->filename); } } return $theme_path; } /** * Allow sub-themes to have their own .tpl.php template files. * * This is an exact copy of _phptemplate_default() with the addition of the * $theme_path and $parent_theme_path */ function _zen_default($hook, $variables, $suggestions = array(), $extension = '.tpl.php') { global $theme_engine; if ($theme_path = path_to_subtheme()) { $parent_theme_path = path_to_theme(); } else { $theme_path = path_to_theme(); } // Loop through any suggestions in FIFO order. $suggestions = array_reverse($suggestions); foreach ($suggestions as $suggestion) { if (!empty($suggestion)) { if (file_exists($theme_path .'/'. $suggestion . $extension)) { $file = $theme_path .'/'. $suggestion . $extension; break; } elseif (!empty($parent_theme_path) && file_exists($parent_theme_path .'/'. $suggestion . $extension)) { $file = $parent_theme_path .'/'. $suggestion . $extension; break; } } } if (!isset($file)) { if (file_exists($theme_path ."/$hook$extension")) { $file = $theme_path ."/$hook$extension"; } elseif (!empty($parent_theme_path) && file_exists($parent_theme_path ."/$hook$extension")) { $file = $parent_theme_path ."/$hook$extension"; } else { if (in_array($hook, array('node', 'block', 'box', 'comment'))) { $file = path_to_engine() .'/'. $hook . $extension; } else { $variables['hook'] = $hook; watchdog('error', t('%engine.engine was instructed to override the %name theme function, but no valid template file was found.', array('%engine' => $theme_engine, '%name' => $hook))); $file = path_to_engine() .'/default'. $extension; } } } if (isset($file)) { return call_user_func('_'. $theme_engine .'_render', $file, $variables); } } /** * To allow themes to have their own template files, we have to override * _phptemplate_default() by dynamically defining _phptemplate_HOOK(). */ function _zen_hook($hook) { if (!function_exists("_phptemplate_$hook")) { // Only create a function if $hook contains letters and underscores. if (!preg_match('/\W/', $hook)) { $declaration = <<