From 90d1b7449dc88b1c69326bca2128b0741226a5f7 Mon Sep 17 00:00:00 2001
From: Mike Shiyan <dev@mike.pp.ua>
Date: Mon, 20 Jul 2015 00:20:35 +0300
Subject: [PATCH] Issue #2536498 by pingwin4eg: Default style status

---
 styleswitcher.module | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/styleswitcher.module b/styleswitcher.module
index bce5067..f56c891 100644
--- a/styleswitcher.module
+++ b/styleswitcher.module
@@ -355,6 +355,7 @@ function styleswitcher_style_load_multiple(array $filter = array()) {
       // Default settings.
       $styles[$key] += array(
         'is_default' => FALSE,
+        'status' => TRUE,
       );
     }
   }
@@ -385,7 +386,11 @@ function styleswitcher_styles_settings() {
   if (!$settings) {
     foreach (_styleswitcher_get_styles() as $key => $style) {
       $settings[$key]['weight'] = $style['weight'];
-      $settings[$key]['status'] = $style['status'];
+    }
+
+    // Disable the blank style if theme has its own default one.
+    if (styleswitcher_theme_default_style_key()) {
+      $settings['custom/default']['status'] = FALSE;
     }
   }
 
@@ -397,7 +402,7 @@ function styleswitcher_styles_properties() {
 
   if (!$styles) {
     foreach (_styleswitcher_get_styles() as $key => $style) {
-      unset($style['weight'], $style['status']);
+      unset($style['weight']);
       $styles[$key] = $style;
     }
   }
@@ -437,7 +442,6 @@ function _styleswitcher_get_styles() {
           'label' => $label,
           'path' => $theme_path . '/' . $path,
           'weight' => $weight++,
-          'status' => TRUE,
         );
       }
     }
@@ -470,7 +474,6 @@ function _styleswitcher_get_styles() {
           'label' => 'Default',
           'path' => $theme_path . '/' . $default,
           'weight' => -1,
-          'status' => TRUE,
         );
         $styles['theme/default'] = $defaults;
         styleswitcher_theme_default_style_key('theme/default');
@@ -478,15 +481,13 @@ function _styleswitcher_get_styles() {
     }
   }
 
-  // Add a 'blank' style (disabled if the theme has its 'default' one), so we
-  // always have our <link> tag ready to be switched.
+  // Add a 'blank' style, so we always have our <link> tag ready to be switched.
   $styles['custom/default'] = array(
     'name' => 'custom/default',
     'label' => 'Default',
     'path' => NULL,
     // Place this style above the default one.
     'weight' => -2,
-    'status' => !isset($default),
   );
 
   return $styles;
-- 
1.9.5.msysgit.0

