You are here

class openlayers_behavior_geofield in Geofield 7

Same name and namespace in other branches
  1. 7.2 includes/behaviors/openlayers_behavior_geofield.inc \openlayers_behavior_geofield

Map Form Values Behavior

Hierarchy

Expanded class hierarchy of openlayers_behavior_geofield

2 string references to 'openlayers_behavior_geofield'
geofield_field_widget_settings_form in ./geofield.widgets.inc
Implements hook_field_widget_settings_form().
geofield_openlayers_behaviors in ./geofield.openlayers.inc
Implements hook_openlayers_behaviors().

File

includes/behaviors/openlayers_behavior_geofield.inc, line 11
Implementation of OpenLayers behavior.

View source
class openlayers_behavior_geofield extends openlayers_behavior {

  /**
   * Provide initial values for options.
   */
  function options_init() {
    return array(
      'feature_types' => array(),
      'allow_edit' => 1,
    );
  }
  function options_form($defaults = array()) {
    $features = array(
      'point' => t('Point'),
      'path' => t('Path'),
      'polygon' => t('Polygon'),
    );
    return array(
      'feature_types' => array(
        '#title' => t('Available Features'),
        '#type' => 'checkboxes',
        '#options' => $features,
        '#description' => t('Select what features are available to draw.'),
        '#default_value' => isset($defaults['feature_types']) ? $defaults['feature_types'] : array(),
      ),
      'allow_edit' => array(
        '#title' => t('Allow shape modification'),
        '#type' => 'checkbox',
        '#description' => t('Can you edit and delete shapes.'),
        '#default_value' => isset($defaults['allow_edit']) ? $defaults['allow_edit'] : 1,
      ),
    );
  }

  /**
   * Render.
   */
  function render(&$map) {
    $geopath = drupal_get_path('module', 'geofield');
    drupal_add_js($geopath . '/includes/behaviors/js/openlayers_behavior_geofield.js');
    return $this->options;
  }

}

Members