You are here

function theme_getlocations_settings_form in Get Locations 7.2

Same name and namespace in other branches
  1. 7 getlocations.module \theme_getlocations_settings_form()

Returns HTML of the getlocations settings form.

Parameters

array $variables: An associative array containing:

  • form: The form array.

Return value

string The rendered form

File

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

Code

function theme_getlocations_settings_form($variables) {
  $form = $variables['form'];
  $fieldables = getlocations_get_fieldable_entity_types();
  $output = '';

  // return links
  foreach ($fieldables as $entity_type) {
    if (isset($form['getlocations_default']['returnlink_' . $entity_type . '_link'])) {
      $form['getlocations_default']['returnlink_' . $entity_type . '_link']['#prefix'] = '<div id="wrap-' . $entity_type . '-link">';
      $form['getlocations_default']['returnlink_' . $entity_type . '_link']['#suffix'] = '</div>';
    }
  }
  if (isset($form['getlocations_colorbox']['width']) && isset($form['getlocations_colorbox']['height'])) {
    $form['getlocations_colorbox']['width']['#prefix'] = '<div id="wrap-getlocations-colorbox">';
    $form['getlocations_colorbox']['height']['#suffix'] = '</div>';
  }
  if (isset($form['getlocations_colorbox']['marker_width']) && isset($form['getlocations_colorbox']['marker_height'])) {
    $form['getlocations_colorbox']['marker_width']['#prefix'] = '<div id="wrap-getlocations-marker-colorbox">';
    $form['getlocations_colorbox']['marker_height']['#suffix'] = '</div>';
  }

  // marker colorbox
  // TODO
  if (module_exists('colorbox')) {
    $getlocations_colorbox = getlocations_colorbox_settings();
    if ($getlocations_colorbox['marker_enable']) {

      //////////////////
      foreach ($fieldables as $entity_type) {
        $entity_get_info = entity_get_info($entity_type);
        $label = $entity_get_info['label'];

        #$link = getlocations_markerpicker_link($form['getlocations_default'][$entity_type . '_map_marker']['#id'], 'n');
        $link = getlocations_markerpicker_link($form['getlocations_default'][$entity_type . '_map_marker']['#id'], $label);
        $form['getlocations_default'][$entity_type . '_map_marker']['#field_suffix'] = '&nbsp;' . $link;
      }
      if (module_exists('getlocations_fields')) {
        $link = getlocations_markerpicker_link($form['getlocations_default']['input_map_marker']['#id'], t('Input'));
        $form['getlocations_default']['input_map_marker']['#field_suffix'] = '&nbsp;' . $link;
      }

      //////////////////
      $type_markers = getlocations_get_type_markers();
      foreach ($type_markers as $entity_type => $bundles) {
        $entity_get_info = entity_get_info($entity_type);
        $entity_type_label = $entity_get_info['label'];
        foreach ($bundles as $bundle => $field_names) {
          foreach ($field_names as $field_name => $marker_data) {
            $bundle_label = $marker_data['bundle_label'];
            $link = getlocations_markerpicker_link($form['getlocations_markers'][$entity_type][$bundle][$field_name]['marker']['#id'], $label);
            $form['getlocations_markers'][$entity_type][$bundle][$field_name]['marker']['#field_suffix'] = '&nbsp;' . $link;
          }
        }
      }

      //////////////////

      #      $link = getlocations_markerpicker_link($form['getlocations_default']['node_map_marker']['#id'], 'n');

      #      $form['getlocations_default']['node_map_marker']['#field_suffix'] = '&nbsp;' . $link;

      #

      #      if (isset($form['getlocations_default']['user_map_marker'])) {

      #        $link = getlocations_markerpicker_link($form['getlocations_default']['user_map_marker']['#id'], 'u');

      #        $form['getlocations_default']['user_map_marker']['#field_suffix'] = '&nbsp;' . $link;

      #      }

      #      if (module_exists('taxonomy')) {

      #        if (isset($form['getlocations_default']['vocabulary_map_marker'])) {

      #          $link = getlocations_markerpicker_link($form['getlocations_default']['vocabulary_map_marker']['#id'], 'v');

      #          $form['getlocations_default']['vocabulary_map_marker']['#field_suffix'] = '&nbsp;' . $link;

      #        }

      #        if (isset($form['getlocations_default']['term_map_marker'])) {

      #          $link = getlocations_markerpicker_link($form['getlocations_default']['term_map_marker']['#id'], 'v');

      #          $form['getlocations_default']['term_map_marker']['#field_suffix'] = '&nbsp;' . $link;

      #        }

      #      }

      #      if (isset($form['getlocations_default']['comment_map_marker'])) {

      #        $link = getlocations_markerpicker_link($form['getlocations_default']['comment_map_marker']['#id'], 'c');

      #        $form['getlocations_default']['comment_map_marker']['#field_suffix'] = '&nbsp;' . $link;

      #      }

      #      if ($types = getlocations_get_types()) {

      #        foreach ($types AS $type => $name) {

      #          $field_names = getlocations_get_fieldname2($type, 'node');

      #          foreach ($field_names AS $field_name) {

      #            if (isset($form['getlocations_node_marker']['content_type'][$type]['field_name'][$field_name]['map_marker'])) {

      #              $link = getlocations_markerpicker_link($form['getlocations_node_marker']['content_type'][$type]['field_name'][$field_name]['map_marker']['#id'], 'n');

      #              $form['getlocations_node_marker']['content_type'][$type]['field_name'][$field_name]['map_marker']['#field_suffix'] = '&nbsp;' . $link;

      #            }

      #          }

      #        }

      #      }

      #      if (module_exists('taxonomy')) {

      #        if ($types = getlocations_get_vocabularies()) {

      #          foreach ($types AS $type => $name) {

      #            if (isset($form['getlocations_vocabulary_marker']['vocabulary'][$type]['map_marker'])) {

      #              $link = getlocations_markerpicker_link($form['getlocations_vocabulary_marker']['vocabulary'][$type]['map_marker']['#id'], 'v');

      #              $form['getlocations_vocabulary_marker']['vocabulary'][$type]['map_marker']['#field_suffix'] = '&nbsp;' . $link;

      #            }

      #          }

      #        }

      #

      #        // term

      #        $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);

      #            $tct = 0;

      #            foreach ($terms AS $term) {

      #              $tid = $term->tid;

      #              if (isset($form['getlocations_term_marker']['vid'][$vid]['term'][$tid]['map_marker'])) {

      #                $link = getlocations_markerpicker_link($form['getlocations_term_marker']['vid'][$vid]['term'][$tid]['map_marker']['#id'], 'n');

      #                $form['getlocations_term_marker']['vid'][$vid]['term'][$tid]['map_marker']['#field_suffix'] = '&nbsp;' . $link;

      #                if (! $tct) {

      #                  $v = taxonomy_vocabulary_load($vid);

      #                  $vocab_name = $v->name;

      #                  $form['getlocations_term_marker']['vid'][$vid]['term'][$tid]['map_marker']['#prefix'] = t('Terms for %name', array('%name' => $vocab_name));

      #                }

      #              }

      #              $tct++;

      #            }

      #          }

      #        }

      #      }
    }
  }
  $form['getlocations_default']['useclustermanager']['#prefix'] = '<div id="wrap-getlocations-clusteropts">';
  $form['getlocations_default']['markerclusterer_minsize']['#suffix'] = '</div>';
  $form['getlocations_default']['usemarkermanager']['#prefix'] = '<div id="wrap-getlocations-markeropts">';
  $form['getlocations_default']['maxzoom']['#suffix'] = '</div>';
  if (isset($form['getlocations_default']['gps_button']) && $form['getlocations_default']['gps_button']['#type'] !== 'value') {
    $form['getlocations_default']['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['getlocations_default']['gps_center']['#suffix'];
    $form['getlocations_default']['gps_center']['#suffix'] = $tsuf . '</div></fieldset>';
  }
  if (isset($form['getlocations_default']['smartip_button']) && $form['getlocations_default']['smartip_button']['#type'] !== 'value') {
    $form['getlocations_default']['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['getlocations_default']['smartip_center']['#suffix'];
    $form['getlocations_default']['smartip_center']['#suffix'] = $tsuf . '</div></fieldset>';
  }

  // preview
  $getlocations_defaults = getlocations_defaults();
  $getlocations_defaults['extcontrol'] = 'preview_map';
  $mapid = getlocations_setup_map($getlocations_defaults);
  $minmaxes = '';
  $latlons = array();
  getlocations_js_settings_do($getlocations_defaults, $latlons, $minmaxes, $mapid, FALSE, $getlocations_defaults['extcontrol']);
  $preview_map = theme('getlocations_show', array(
    'width' => $getlocations_defaults['width'],
    'height' => $getlocations_defaults['height'],
    'defaults' => $getlocations_defaults,
    'mapid' => $mapid,
    'latlons' => $latlons,
    'minmaxes' => $minmaxes,
    'entity_info' => '',
    'object' => '',
  ));
  $form['getlocations_preview']['preview_map']['#markup'] = '<div id="getlocations_preview_map">' . $preview_map . '</div>';
  $output .= drupal_render_children($form);
  return $output;
}