From 6063b89e608e5e0eb46110cd8e9259edde0bec06 Mon Sep 17 00:00:00 2001
From: morbiD <morbiD@319819.no-reply.drupal.org>
Date: Fri, 26 Apr 2013 12:34:24 +0100
Subject: [PATCH] Issue #1608050 by morbiD: Fixed css3pie_css_selectors being a required field.

---
 css3pie.admin.inc |   37 ++++++++++++++++---------------------
 1 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/css3pie.admin.inc b/css3pie.admin.inc
index ddf53ff..88aaace 100644
--- a/css3pie.admin.inc
+++ b/css3pie.admin.inc
@@ -10,22 +10,12 @@
 function css3pie_admin() {
   $form = array();
   $css3pie_theme_settings = FALSE;
-  $selectors_required = TRUE;
   $use_theme_info = FALSE;
   
-  $result = db_query("SELECT s.name FROM {system} s WHERE s.status=1 AND s.type='theme'");
-  
-  foreach ($result as $record) {
-    if ($css3pie_theme_selectors = theme_get_setting('css3pie', $record->name)) {
-      $selectors_required = FALSE;
-      $use_theme_info = TRUE;
-    }
-  }
-
   $form['css3pie_css_selectors'] = array(
     '#type' => 'textarea',
-    '#title' => t('CSS Selectors'),
-    '#required' => $selectors_required,
+    '#title' => t('CSS selectors'),
+    '#required' => FALSE,
     '#cols' => 40,
     '#rows' => 3,
     '#prefix' => '<div class="css3pie-selector">',
@@ -79,16 +69,21 @@ function css3pie_admin() {
     '#default_value' => variable_get('css3pie_css_use_js_mode', FALSE),
   );
 
-  // If one of the currently enabled themes has selectors in the info file set enable this
-  if ($use_theme_info) {
-    $form['css3pie_css_use_theme_settings'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Use theme settings'),
-      '#description' => t("Use selector settings from theme info file"),
-      '#default_value' => variable_get('css3pie_css_use_theme_settings', FALSE),
-    );
-  }
+  $result = db_query("SELECT s.name FROM {system} s WHERE s.status=1 AND s.type='theme'");
 
+  // If one of the enabled themes defines css3pie selectors in its .info file,
+  // include an option to use them.
+  foreach ($result as $record) {
+    if ($css3pie_theme_selectors = theme_get_setting('css3pie', $record->name)) {
+      $form['css3pie_css_use_theme_settings'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Use theme settings'),
+        '#description' => t("Use selector settings from theme info file"),
+        '#default_value' => variable_get('css3pie_css_use_theme_settings', FALSE),
+      );
+      break;
+    }
+  }
 
   if (!file_exists(libraries_get_path('PIE') . '/PIE.htc')) {
     drupal_set_message(t('PIE library missing. Download PIE library from http://css3pie.com/ and add it to sites/all/libraries/PIE.'), 'error');
-- 
1.7.4.msysgit.0

