You are here

function process_gmap_style in GMap Module 7.2

Same name and namespace in other branches
  1. 5 gmap.module \process_gmap_style()
  2. 6.2 gmap.module \process_gmap_style()
  3. 6 gmap.module \process_gmap_style()
  4. 7 gmap.module \process_gmap_style()

Style fieldset #process function.

@todo move this to GmapElement class

1 string reference to 'process_gmap_style'
gmap_element_info in ./gmap.module
Implements hook_element_info().

File

./gmap.module, line 739
GMap -- Routines to use the Google Maps API in Drupal.

Code

function process_gmap_style($element) {
  $isline = $element['#gmap_style_type'] == 'line';

  // Stroke color.
  $element[0] = array(
    '#type' => 'textfield',
    '#size' => 6,
    '#maxlength' => 6,
    '#field_prefix' => '#',
    '#title' => t('Stroke color'),
    '#value' => $element['#value'][0],
    '#attributes' => array(
      'class' => array(
        'gmap_style',
      ),
    ),
  );

  // Stroke weight.
  $element[1] = array(
    '#type' => 'textfield',
    '#title' => t('Stroke weight'),
    '#description' => t('Thickness of line, in pixels.'),
    '#size' => 3,
    '#maxlength' => 3,
    '#field_suffix' => t('px'),
    '#value' => $element['#value'][1],
    '#attributes' => array(
      'class' => array(
        'gmap_style',
      ),
    ),
  );

  // Stroke opacity.
  $element[2] = array(
    '#type' => 'textfield',
    '#title' => t('Stroke opacity'),
    '#size' => 3,
    '#maxlength' => 3,
    '#field_suffix' => '%',
    '#value' => $element['#value'][2],
    '#attributes' => array(
      'class' => array(
        'gmap_style',
      ),
    ),
  );

  // Fill color.
  $element[3] = array(
    '#type' => 'textfield',
    '#title' => t('Fill color'),
    '#description' => t('Hex color value for fill color. Example: #<em>00AA33</em>'),
    '#size' => 6,
    '#maxlength' => 6,
    '#field_prefix' => '#',
    '#value' => $isline ? '' : $element['#value'][3],
    '#disabled' => $isline,
    '#attributes' => array(
      'class' => array(
        'gmap_style',
      ),
    ),
  );
  $element[4] = array(
    '#type' => 'textfield',
    '#title' => t('Fill opacity'),
    '#description' => t('Opacity of fill, from 0 to 100%.'),
    '#size' => 3,
    '#maxlength' => 3,
    '#field_suffix' => '%',
    '#value' => $isline ? '' : $element['#value'][4],
    '#disabled' => $isline,
    '#attributes' => array(
      'class' => array(
        'gmap_style',
      ),
    ),
  );
  unset($element['#input']);
  $element_info = element_info('fieldset');
  $element = array_merge($element, $element_info);
  return $element;
}