Acquia Marina/Fusion Core with domain themes - a problem !?!

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
shushu's picture

Hello,
I am using domain access and domain theme to create subdomains and to theme them specifically.
Till I started working with Skinr/Fusion/Acquia Marina everything worked fine with setting theme configuration per theme.

Since Acquia Marina and Fusion is such a nice looking theme I decided to move to it, and setup the main domain.com to it, changing all I wanted.

Then I created another subtheme of Fusion (I copied Acquia Marina, and properly changed all of the names) and selected it for my subdomain.domain.com.

Since something looked aweful I looked under the hood and found out $body_classes was wrong, and that theme_get_setting('theme_grid') gave empty string.

Looking at the code I saw all it does is to:

<?php

    $settings
= array_merge($settings, variable_get(str_replace('/', '<em>', 'theme</em>'. $key .'_settings'), array()));
?>

So I created the following "debug" node with PHP:
<?php
print_r
(variable_get('theme_mytheme_settings', array()));
?>

Amazingly, when looking at http://domain.com/debug I get (as it is in the database):
<?php
Array
(
    [
toggle_logo] => 0
   
[toggle_name] => 0
   
[toggle_slogan] => 0
   
[toggle_node_user_picture] => 0
   
[toggle_comment_user_picture] => 0
   
[toggle_search] => 0
   
[toggle_favicon] => 0
   
[toggle_primary_links] => 0
   
[toggle_secondary_links] => 0
   
[default_logo] => 1
   
[logo_path] =>
    [
logo_upload] =>
    [
default_favicon] => 1
   
[favicon_path] =>
    [
favicon_upload] =>
    [
theme_grid] => grid16-960
   
[fluid_grid_width] => fluid-100
   
[sidebar_layout] => sidebars-split
   
[sidebar_first_width] => 4
   
[sidebar_last_width] => 3
   
[theme_font] => none
   
[theme_font_size] => font-size-12
   
[primary_menu_dropdown] => 1
   
[breadcrumb_display] => 1
   
[search_snippet] => 0
   
[search_info_type] => 0
   
[search_info_user] => 0
   
[search_info_date] => 0
   
[search_info_comment] => 0
   
[search_info_upload] => 0
   
[user_notverified_display] => 1
   
[block_config_link] => 1
   
[grid_mask] => 0
   
[rebuild_registry] => 0
   
[fix_css_limit] => 0
)
?>

But when I look at http://subdomain.domain.com/debug I get:
<?php
Array
(
    [
toggle_logo] => 0
   
[toggle_name] => 0
   
[toggle_slogan] => 0
   
[toggle_node_user_picture] => 0
   
[toggle_comment_user_picture] => 0
   
[toggle_search] => 0
   
[toggle_favicon] => 0
   
[toggle_primary_links] => 0
   
[toggle_secondary_links] => 0
   
[default_logo] => 1
   
[logo_path] =>
    [
logo_upload] =>
    [
default_favicon] => 1
   
[favicon_path] =>
    [
favicon_upload] =>
    [
theme_grid] =>
    [
fluid_grid_width] =>
    [
sidebar_layout] =>
    [
sidebar_first_width] =>
    [
sidebar_last_width] =>
    [
theme_font] =>
    [
theme_font_size] =>
    [
primary_menu_dropdown] => 0
   
[breadcrumb_display] => 0
   
[search_snippet] => 0
   
[search_info_type] => 0
   
[search_info_user] => 0
   
[search_info_date] => 0
   
[search_info_comment] => 0
   
[search_info_upload] => 0
   
[user_notverified_display] => 0
   
[block_config_link] => 0
   
[grid_mask] => 0
   
[rebuild_registry] => 0
   
[fix_css_limit] => 0
   
[theme] => mytheme
)
?>

How can that be ?
Why the global $conf has different values while looking at the same value via the main domain and the subdomain ?
What do I miss ?

Any help will be appreciated.

Regards,
Shushu

Comments

It seems it is fusion's fault...

shushu's picture

What I have found is that Fusion's phptemplate_settings() (in theme-settings.php) gets the theme name from arg(count(arg()) - 1), which does not fit to domain_theme path, and then it shows and saves wrong information.

I am certain there is a "right" way to get the theme on the subject other than getting it from arg(), but meanwhile my solution is similar, just a bit better:

<?php
 
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);
  }
?>

This one was an ugly bug to catch...

Thank you for your feedback

sociotech's picture

shushu,

Thanks for your detailed feedback and troubleshooting efforts on this issue.

First of all, I'd probably recommend filing this as an issue in the Fusion queue (http://drupal.org/project/issues/fusion), since that's where it's more likely to get fixed.

Second, I'm open to suggestions as to a better way to get the name of the theme whose settings are being edited. Keep in mind that the theme in question may not be the current default theme or there may be an admin theme in use. Also, the variables passed to the phptemplate_settings() function do not contain the name of the theme whose settings are being edited.

Third, while your solution may work well for your situation, it would still fail if another argument were added in front of the arguments you were checking for. For example, on a site with an Arabic translation, the URL might be http://subdomain.domain.com/ar/admin/build/themes/settings/fusion_starter.

Fourth, this problem will be resolveable with Drupal 7 because the variables passed to the form_system_theme_settings_alter() function (the replacement for the phptemplate_settings() function) do contain the name of the theme whose settings are being edited.

Nevertheless, I'd love to hear suggestions for alternative solutions for this issue in Drupal 6 that might be more generally effective than the current solution and that don't involve module-specific code (which often ends up creating more troublesome dependencies and errors than it fixes).

Thanks again.

Thanks. Issue is opened as

shushu's picture

Thanks.
Issue is opened as well.
I now see the code I submitted is not full.
The $index in my code is the place of "admin", so it suppose to cover international sites.
I understand (from experience) that the $theme is irrelevant due to the reasons you mentioned, this is why my solution depends on arg() as well.
A "generic" solution might be to create a hook that only returns the relevant theme name, so everyone will be able to add its own without touching the original code.

I will try to submit a better code soon.

Full details were added by me

shushu's picture

Full details were added by me to the issue.

@sociotech, Since it solves the 3rd issue you mentioned, and since except creating a specific hook for this problem I can't think about a generic solution, I think this solution should be selected, at least for now.

TNT Themes

Group organizers

Group categories

Type of post

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week