See details here - http://groups.drupal.org/node/68798#comment-209898
The solution might be different than mine, but for my cause it solves the problem -
// Option #1 - admin/build/themes/settings/theme name
if ((arg($index + 1) == 'build') && (arg($index + 2) == 'themes') && (arg($index + 3) == 'settings')) {
$theme_name = arg($index + 4);
} elseif ((arg($index + 1) == 'build') && (arg($index + 2) == 'domain') && (arg($index + 3) == 'theme')) {
// Option #2 - admin/build/domain/theme/theme name/56/theme-settings
$theme_name = arg($index + 4);
}
Regards,
Shushu
Comments
Comment #1
sociotech commentedShushu,
Just wondering if you've had any luck finding a more generic approach to getting the theme name in phptemplate_settings().
Comment #2
shushu commentedNo, I didn't, but I didn't have time to look for it either...
Comment #3
shushu commentedI think that since each module might use this feature, the right solution would be creating a specific hook for it, and invoking it from here, so each module will be able to give his own solution.
Meanwhile, I just wanted to show the full solution I got, solving core + domains module cases. It is based on finding the 'admin' argument in the URL, and counting from it.
Comment #4
coltraneWoh, domain access does some funky stuff to the URL. I wonder if core functions like
menu_get_item()respect (or ignore well enough) what domain access does to extract the theme name correctly.Comment #5
coltranedomain_theme form alters the system_theme_settings form where Fusion's
phptemplate_settings()gets called and extracts the theme name from arg(4) http://drupalcode.org/project/domain.git/blob/4c1f88e07b490f6f67acc3645b... arg(4) matches what the code in #3 gets to so perhaps rather than searching through the URL args instead we do:Comment #6
dvessel commentedI was looking into a different problem with "hook_form_system_theme_settings_alter" and ran into this. Thought I'd chime in if you didn't find a fix already.
There are two global variables that holds the theme name. One is $theme and the other is $theme_key. What I do with my themes is to provide a function to access the correct key depending what you need. Hope the comments below is clear.
I've been using this in Drupal 7 but I'm pretty sure it hasn't changed since 6.
Comment #7
Poieo commentedClosing as won't fix since the D6 version is not getting any new development.