Domain_theme module uses hook_custom_theme to change the default theme for certain domains.

When i visit that domain as an anonymous user, $sweaver->get_theme_key() returns the theme defined in hook_custom_theme.
If i try to change the theme as user one using sweaver, $sweaver->get_theme_key() returns the default theme provided.

This means i cannot use sweaver to style pages that have their theme changed using hook_custom_theme.

Is it posible to reset the sweaver instance on hook_custom_theme?

Files: 
CommentFileSizeAuthor
#3 sweaver-7.x-1.x-dev_use-menu-get-custom-theme-1346028.patch537 bytesRory
Test request sent.
[ View ]

Comments

Title:Sweaver frontend form initiated before hook_custom_themeUse menu_get_custom_theme in __construct

I figured it out.

The sweaver object constructor uses variable_get('theme_default', 'garland') to set_current_theme.
If a custom theme exists this should be used instead of the theme_default variable

private function __construct() {
    if ($theme_key = sweaver_session(NULL, 'sweaver_theme')) {
      $this->set_current_style($theme_key);
    }
    else {
      $this->set_current_style(variable_get('theme_default', 'garland'));
    }
    if (!$this->is_configured()) {
      $this->register_plugins_configuration();
    }
  }

should be

private function __construct() {
    if ($theme_key = sweaver_session(NULL, 'sweaver_theme')) {
      $this->set_current_style($theme_key);
    }
    else {
      if ($custom_theme = menu_get_custom_theme()) {
        $this->set_current_style($custom_theme);
      }
      else {
        $this->set_current_style(variable_get('theme_default', 'garland'));
      }
    }
    if (!$this->is_configured()) {
      $this->register_plugins_configuration();
    }
  }

Assigned:Unassigned» swentel

Version:7.x-1.1» 7.x-1.x-dev
Status:Active» Needs review
StatusFileSize
new537 bytes
Test request sent.
[ View ]

Patch attached.