You are here

function theme_getlocations_plugin_style_map_options_form in Get Locations 7

Same name and namespace in other branches
  1. 7.2 getlocations.module \theme_getlocations_plugin_style_map_options_form()

Returns HTML of the getlocations plugin_style_map_options form.

Parameters

array $variables: An associative array containing:

  • form: The form array.

Return value

string The rendered form

File

./getlocations.module, line 7600
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function theme_getlocations_plugin_style_map_options_form($variables) {
  $form = $variables['form'];
  if (module_exists('colorbox')) {
    $getlocations_colorbox = getlocations_colorbox_settings();
    if ($getlocations_colorbox['marker_enable']) {
      if (isset($form['node_map_marker'])) {
        $link = getlocations_markerpicker_link($form['node_map_marker']['#id'], 'n');
        $form['node_map_marker']['#field_suffix'] = ' ' . $link;
      }
      $getlocations_node_marker = variable_get('getlocations_node_marker', array(
        'enable' => 0,
      ));
      if ($getlocations_node_marker['enable']) {
        if ($types = getlocations_get_types()) {
          foreach ($types as $type => $name) {
            $field_names = getlocations_get_fieldname2($type, 'node');
            foreach ($field_names as $field_name) {
              $mkey = 'node_marker__' . drupal_strtolower($type) . '__' . $field_name;
              $link = getlocations_markerpicker_link($form[$mkey]['#id'], 'n');
              $form[$mkey]['#field_suffix'] = ' ' . $link;
            }
          }
        }
      }
      if (isset($form['user_map_marker'])) {
        $link = getlocations_markerpicker_link($form['user_map_marker']['#id'], 'u');
        $form['user_map_marker']['#field_suffix'] = ' ' . $link;
      }
      if (module_exists('taxonomy')) {
        if (isset($form['vocabulary_map_marker'])) {
          $link = getlocations_markerpicker_link($form['vocabulary_map_marker']['#id'], 'v');
          $form['vocabulary_map_marker']['#field_suffix'] = ' ' . $link;
        }
        $getlocations_vocabulary_marker = variable_get('getlocations_vocabulary_marker', array(
          'enable' => 0,
        ));
        if ($getlocations_vocabulary_marker['enable']) {
          foreach ($types as $type => $name) {
            $field_name = getlocations_get_fieldname($type, 'taxonomy_term');
            $mkey = 'vocabulary_marker_' . $field_name;
            $link = getlocations_markerpicker_link($form[$mkey]['#id'], 'v');
            $form[$mkey]['#field_suffix'] = ' ' . $link;
          }
        }
        if (isset($form['term_map_marker'])) {
          $link = getlocations_markerpicker_link($form['term_map_marker']['#id'], 't');
          $form['term_map_marker']['#field_suffix'] = ' ' . $link;
        }
        $getlocations_term_marker = variable_get('getlocations_term_marker', array(
          'enable' => 0,
          'vids' => 0,
          'max_depth' => '',
        ));
        if ($getlocations_term_marker['enable'] && $getlocations_term_marker['vids']) {
          $depth = is_numeric($getlocations_term_marker['max_depth']) && $getlocations_term_marker['max_depth'] > 0 ? $getlocations_term_marker['max_depth'] : NULL;
          $vids = $getlocations_term_marker['vids'];
          foreach ($vids as $vid) {
            $terms = taxonomy_get_tree($vid, 0, $depth);
            foreach ($terms as $term) {
              $name = $term->name;
              $tid = $term->tid;
              $mkey = 'term_marker_' . $tid;
              $link = getlocations_markerpicker_link($form[$mkey]['#id'], 't');
              $form[$mkey]['#field_suffix'] = ' ' . $link;
            }
          }
        }
      }
      if (isset($form['comment_map_marker'])) {
        $link = getlocations_markerpicker_link($form['comment_map_marker']['#id'], 'c');
        $form['comment_map_marker']['#field_suffix'] = ' ' . $link;
      }
      if (isset($form['gps_marker'])) {
        $link = getlocations_markerpicker_link($form['gps_marker']['#id'], 'g');
        $form['gps_marker']['#field_suffix'] = ' ' . $link;
      }
      if (isset($form['smartip_marker'])) {
        $link = getlocations_markerpicker_link($form['smartip_marker']['#id'], 'm');
        $form['smartip_marker']['#field_suffix'] = ' ' . $link;
      }
    }
  }
  if (isset($form['gps_button']) && $form['gps_button']['#type'] !== 'value') {
    $form['gps_button']['#prefix'] = '<fieldset class="collapsible getlocations_fieldset form-wrapper"><legend><span class="fieldset-legend">' . t('GPS Button') . '</span></legend><div class="fieldset-wrapper">';
    $tsuf = $form['gps_center']['#suffix'];
    $form['gps_center']['#suffix'] = $tsuf . '</div></fieldset>';
  }
  if (isset($form['smartip_button']) && $form['smartip_button']['#type'] !== 'value') {
    $form['smartip_button']['#prefix'] = '<fieldset class="collapsible getlocations_fieldset form-wrapper"><legend><span class="fieldset-legend">' . t('Smartip Button') . '</span></legend><div class="fieldset-wrapper">';
    $tsuf = $form['smartip_center']['#suffix'];
    $form['smartip_center']['#suffix'] = $tsuf . '</div></fieldset>';
  }
  $output = drupal_render_children($form);
  return $output;
}