You are here

class openlayers_test_rnd_int in Openlayers 6.2

Style Plugin for testing purposes.

Hierarchy

Expanded class hierarchy of openlayers_test_rnd_int

1 string reference to 'openlayers_test_rnd_int'
openlayers_test_rnd_int.inc in tests/plugins/style_plugin/openlayers_test_rnd_int.inc
Test

File

tests/plugins/style_plugin/openlayers_test_rnd_int.inc, line 22
Test

View source
class openlayers_test_rnd_int extends openlayers_style_plugin {

  /**
   * Provide initial values for options.
   */
  function options_init() {
    return array(
      'low' => 1,
      'high' => 10,
    );
  }

  /**
   * Options form.
   */
  function options_form($defaults = array()) {
    $form = array();

    // Allow use to pick the highest and lowest for random
    // point radius
    $form['low'] = array(
      '#type' => 'textfield',
      '#title' => t('Lowest value'),
      '#description' => t('Lowest value for the random integer.'),
      '#default_value' => isset($defaults['low']) ? $defaults['low'] : 2,
    );
    $form['high'] = array(
      '#type' => 'textfield',
      '#title' => t('Highest value'),
      '#description' => t('Highest value for the random integer.'),
      '#default_value' => isset($defaults['high']) ? $defaults['high'] : 10,
    );
    return $form;
  }

  /**
   * Get an array of style property callbacks
   */
  function get_context_properties() {
    return array(
      'pointRadius' => 'getInt',
      'strokeWidth' => 'getInt',
      'graphicWidth' => 'getInt',
      'graphicHeight' => 'getInt',
      'graphicXOffset' => 'getInt',
      'graphicYOffset' => 'getInt',
      'rotation' => 'getInt',
      'labelXOffset' => 'getInt',
      'labelYOffset' => 'getInt',
      'fontSize' => 'getInt',
    );
  }

  /**
   * Render function
   */
  function render() {

    // Add JS
    drupal_add_js(drupal_get_path('module', 'openlayers_test') . '/plugins/style_plugin/openlayers_test_rnd_int.js');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
openlayers_style_plugin::can_handle_property function Return true if this plugin can handle the given property
openlayers_test_rnd_int::get_context_properties function Get an array of style property callbacks Overrides openlayers_style_plugin::get_context_properties
openlayers_test_rnd_int::options_form function Options form. Overrides openlayers_style_plugin::options_form
openlayers_test_rnd_int::options_init function Provide initial values for options. Overrides openlayers_style_plugin::options_init
openlayers_test_rnd_int::render function Render function Overrides openlayers_style_plugin::render