openlayers_cck_widget_settings

openlayers/modules/openlayers_cck/openlayers_cck.module, line 74

Versions
6
openlayers_cck_widget_settings($op, $widget)

Implementation of hook_widget_settings().

Code

<?php
function openlayers_cck_widget_settings($op, $widget) {
  switch ($op) {
    case 'form':
      // Get defaults, check if there are already defaults
      // @@TODO: What if the global defaults have not been created in the interface
      if (isset($widget['openlayers_cck'])) {
        $defaults = $widget['openlayers_cck'];
      }
      else {
        $defaults = variable_get('openlayers_defaults_form', array());
      }
      
      // Get map form
      $map_form = openlayers_map_form($defaults);
      
      // Put form into a collapsed fieldset, as this promotes good usability
      // Most users will not want to edit these fields
      $form['openlayers_cck'] = $map_form;
      $form['openlayers_cck']['#type'] = 'fieldset';
      $form['openlayers_cck']['#title'] = t('Map Settings');
      $form['openlayers_cck']['#description'] = t('These are the settings that determine how the map will look.');
      $form['openlayers_cck']['#collapsible'] = TRUE;
      $form['openlayers_cck']['#collapsed'] = TRUE;
      // Return form
      return $form;

    case 'validate':
      openlayers_map_form_validate($widget['openlayers_cck']);
      break;

    case 'save':
      // @@TODO: Figure out a way to save this form in an easy way.
      // Ideally we just want to save the map array.
      // We could create a DB table to save this information.
      return array('openlayers_cck');
  }
}
?>