Index: modules/openlayers_ui/includes/openlayers_ui.styles.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/modules/openlayers_ui/includes/Attic/openlayers_ui.styles.inc,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 openlayers_ui.styles.inc
--- modules/openlayers_ui/includes/openlayers_ui.styles.inc	29 Jun 2010 18:55:34 -0000	1.1.2.8
+++ modules/openlayers_ui/includes/openlayers_ui.styles.inc	30 Jun 2010 10:14:39 -0000
@@ -169,6 +169,9 @@ function openlayers_ui_styles_form(&$for
   $form['info'] = array(
     '#type' => 'fieldset',
     '#tree' => FALSE,
+    '#title' => t('Basic Information'),
+    '#description' => t('The basic information for the style, used to refer to and describe the style.'),
+    '#collapsible' => TRUE,
   );
   $form['info']['name'] = array(
     '#title' => t('Name'),
@@ -189,8 +192,16 @@ function openlayers_ui_styles_form(&$for
   );
 
   // OpenLayers style properties
-  $form['data'] = array('#type' => 'fieldset', '#tree' => TRUE);
-
+  $form['data'] = array(
+    '#type' => 'fieldset', 
+    '#tree' => TRUE,
+    '#title' => t('Style Properties and Plugins'),
+    '#description' => t('Style properties are properties as 
+      defined by the OpenLayers library.  Plugins are dynamically
+      process the layer at render time; plugins may override the
+      values that you have set for style properies.'),
+    '#collapsible' => TRUE,
+  );
   foreach ($properties as $key => $prop) {
     $form['data'][$key] = array(
       '#type' => !isset($prop['options']) ? 'textfield' : 'select',
@@ -205,6 +216,10 @@ function openlayers_ui_styles_form(&$for
       $form['data'][$key]['#options'] = $prop['options'];
     }
   }
+  
+  // Add style plugins
+  $form['data']['plugins'] = openlayers_ui_get_style_plugin_options(
+    isset($style->data) ? $style->data : array());
 
   $form['submit'] = array(
     '#type' => 'submit',
@@ -217,6 +232,7 @@ function openlayers_ui_styles_form(&$for
  * Submit handler for layers.
  */
 function openlayers_ui_styles_form_submit(&$form, &$form_state) {
+
   $style_data = $form_state['values']['style_data'];
   
   // Cast and unset values so JS can handle them better
@@ -235,13 +251,31 @@ function openlayers_ui_styles_form_submi
       }
     }
   }
-  
+
+  $data = $form_state['values']['data'];
+
+  // Process style plugins.  This allows us to have simpler
+  // arrays for plugins.
+  if ($data['plugins']) {
+    foreach ($data['plugins'] as $plugin => $settings) {
+      if ($settings['enabled']) {
+        $data['plugins'][$plugin] = isset($data['options']) ?
+          $data['options'] : array();
+      }
+      else {
+        unset($data['plugins'][$plugin]);
+      }
+    }
+  }
+
+  // Create style object
   $style = new stdClass();
   $style->name = $form_state['values']['name'];
   $style->title = $form_state['values']['title'];
   $style->description = $form_state['values']['description'];
-  $style->data = $form_state['values']['data'];
+  $style->data = $data;
 
+  // Save values
   $success = openlayers_style_save($style);
   
 
@@ -255,6 +289,45 @@ function openlayers_ui_styles_form_submi
   }
 }
 
+/**
+ * Get style plugin options.
+ */
+function openlayers_ui_get_style_plugin_options($defaults) {
+  $form = array();
+
+  // Get all available style plugins.
+  foreach (openlayers_style_plugins() as $key => $plugin) {
+    $plugin_class = ctools_plugin_get_class($plugin, 'style_plugin');
+    if (!empty($plugin_class)) {
+      // Create options for oprion form.
+      $options = isset($defaults['plugins'][$key]) ?
+        $defaults['plugins'][$key] : array();
+
+      // Create object
+      $style_plugin = new $plugin_class($options);
+      // Put together fieldset of options.  This should
+      // be improved so that it looks better.
+      $form[$key] = array(
+        '#tree' => TRUE,
+        '#type' => 'fieldset',
+        '#title' => $plugin['title'],
+        '#description' => $plugin['description'],
+        'enabled' => array(
+          '#type' => 'checkbox',
+          '#title' => t('Enabled'),
+          '#default_value' => isset($defaults['plugins'][$key]['enabled'])
+            ? $defaults['plugins'][$key]['enabled'] : FALSE,
+        ),
+      );
+
+      // Add extra options form.
+      $form[$key]['options'] = $style_plugin->options_form($options);
+    }
+  }
+
+  return $form;
+}
+
 // /**
 //  * Import a preset from cut & paste
 //  */
