You are here

function gmap_style_bubbles_form_gmap_admin_settings_alter in GMap Module 7.2

Implements hook_form_FORM_ID_alter().

Adds a new fieldset to the gmap settings form so we can enable and save custom popup bubble styles.

Related topics

File

gmap_style_bubbles/gmap_style_bubbles.module, line 41
Adds the more options for theming the gmap popup bubble.

Code

function gmap_style_bubbles_form_gmap_admin_settings_alter(&$form, &$form_state, $form_id) {
  $bubble_styles = variable_get('gmap_bubble_styles', array());
  $disable_infobubble = FALSE;
  $infobubble_library = libraries_detect('infobubble');
  $form['gmap_bubble_styles'] = array(
    '#type' => 'fieldset',
    '#title' => t('Bubble styles'),
    '#tree' => TRUE,
  );
  if (!$infobubble_library['installed']) {
    $form['gmap_bubble_styles']['error'] = array(
      '#type' => 'markup',
      '#markup' => '<div class="messages error">' . _gmap_style_bubbles_format_error($infobubble_library) . '</div>',
    );
    $disable_infobubble = TRUE;
  }
  $form['gmap_bubble_styles']['enable_bubble_style'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use custom bubble?'),
    '#description' => t('If you don\'t intend to style your popup bubble, leave this unchecked.'),
    '#default_value' => isset($bubble_styles['enable_bubble_style']) ? $bubble_styles['enable_bubble_style'] : 0,
    '#disabled' => $disable_infobubble,
  );
  $form['gmap_bubble_styles']['style_bubble_options'] = array(
    '#type' => 'textarea',
    '#title' => t('Bubble styles to apply'),
    '#description' => t('Styles to apply to your popup bubble. One style per line with a colon between the style and value.<br />Example:<br />shadowStyle:1<br />arrowPosition : 25'),
    '#default_value' => isset($bubble_styles['style_bubble_options']) ? $bubble_styles['style_bubble_options'] : '',
    '#disabled' => $disable_infobubble,
  );
  $form['gmap_bubble_styles']['help_text'] = array(
    '#collapsed' => TRUE,
    '#collapsible' => TRUE,
    '#type' => 'fieldset',
    '#title' => t('Bubble styles help'),
    '#value' => _gmap_style_bubbles_help_text(),
  );
}