You are here

function getlocations_fields_element_origin in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_fields/getlocations_fields.functions.inc \getlocations_fields_element_origin()

Parameters

string $default:

bool $distance:

Return value

Returns form element

3 calls to getlocations_fields_element_origin()
getlocations_fields_handler_field_distance::extra_options_form in modules/getlocations_fields/handlers/getlocations_fields_handler_field_distance.inc
Provide a form for setting options.
getlocations_fields_handler_filter_distance::value_form in modules/getlocations_fields/handlers/getlocations_fields_handler_filter_distance.inc
Options form subform for setting options.
getlocations_fields_handler_sort_distance::extra_options_form in modules/getlocations_fields/handlers/getlocations_fields_handler_sort_distance.inc
Provide a form for setting options.

File

modules/getlocations_fields/getlocations_fields.functions.inc, line 24
getlocations_fields.functions.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_fields_element_origin($default, $distance = FALSE) {
  $options = array(
    'nid_arg' => t("Node's Lat/Lon from views nid argument"),
    'uid_arg' => t("User's Lat/Lon from views uid argument"),
  );
  if (getlocations_get_vocabularies()) {
    $options += array(
      'tid_arg' => t("Term's Lat/Lon from views tid argument"),
    );
  }
  if (module_exists('comment')) {
    $options += array(
      'cid_arg' => t("Comment's Lat/Lon from views cid argument"),
    );
  }
  if ($distance) {
    $options += array(
      'distance_arg' => t("Lat/Lon from views argument"),
    );
  }
  if (module_exists('getlocations_gps')) {
    $options += array(
      'gps' => t("Lat/Lon from Getlocations GPS"),
    );
  }
  $options += array(
    'user' => t("User's Lat/Lon (blank if unset)"),
    'hybrid' => t("User's Lat/Lon (fall back to Static if unset)"),
    'static' => t('Static Lat/Lon'),
    #    'tied' => t("Use Distance / Proximity filter"),

    #    'postal' => t('Postal Code / Country'),

    #    'postal_default' => t('Postal Code (assume default country)'),
    'php' => t('Use PHP code to determine Lat/Lon'),
    'search' => t('Google Autocomplete search'),
  );
  $element = array(
    '#type' => 'select',
    '#title' => t('Origin'),
    '#options' => $options,
    '#description' => t("The way the latitude/longitude is determined. If the origin has multiple locations the first will be used."),
    '#default_value' => $default,
  );
  return $element;
}