You are here

README.txt in Get Locations 7

Views for Getlocations Fields

Name: Getlocations
Description: Provides a block with a link to a map.
This view should work out of the box.


Name: Getlocations map
Description: Provides a map of a locations_fields enabled node.

Configure contextual filter: Content: Nid
Specify validation criteria
Choose the content type


Name: Getlocations map allnodes
Description: Provides a map of all locations_fields enabled nodes.


Name: Getlocations map nearby
Description: Provides a map of all nearby locations_fields enabled nodes.

To get this to work you will need to do some configuring:
Configure contextual filter: Content: Nid
Specify validation criteria
Choose the content type

Configure filter criterion: Getlocations Fields: Distance
Make sure it is pointing to the right Location to use. You can also set the default Operator, Units and Distance.

Configure extra settings for sort criterion Getlocations Fields: Distance
Make sure it is pointing to the right Location to use.

In Block 5 you will want to do the Format > Getlocations > Settings

In Block 6 there is no further configuration required.
You might want to try exposing the Pager, Distance or Order. Remember to set ajax to Yes


Name: Getlocations show all
Description: Provides a map of all locations_fields enabled content types.
You will probably need to flush the cache to get the path 'getlocations_showall' accepted.


Name: Getlocations map allusers
Description: Provides a map of all locations_fields enabled users.


Name: Getlocations User
Description: Provides a link to a map of a locations_fields enabled user.
This view should work out of the box.


Name: Getlocations map nearby users
Description: Provides a map of all nearby locations_fields enabled users.

To get this to work you will need to do some configuring:

Configure contextual filter: User: Uid
Specify validation criteria

Configure filter criterion: Getlocations Fields: Distance
Make sure it is pointing to the right Location to use. You can also set the default Operator, Units and Distance.

Configure extra settings for sort criterion Getlocations Fields: Distance
Make sure it is pointing to the right Location to use.

Name: Getlocations terms
Description: Provides views for getlocations_fields enabled terms


Name: Getlocations by city
Description: Find locations by city in argument
Path: /getlocations_by_city/nnn
where nnn is the name or part of a city


Name: Getlocations by postcode
Description: Find locations by postcode in argument
Path: /getlocations_by_postcode/nnn
where nnn is the name or part of a postcode


Name: Getlocations by province
Description: Find locations by province in argument
Path: /getlocations_by_province/nnn
where nnn is the name or part of a province


Name: Getlocations by country
Description: Find locations by country in argument
Path: /getlocations_by_country/nn
where nn is the country code

Name: Getlocations search nearby
Description: Provides a map and form using Google Autocomplete search
Path: /getlocations_search_nearby
The exposed form contains a Google Autocomplete textbox, Unit selector and Distance textbox.
This form can be configured to appear with the page or in a block.

In the View, under "Advanced", if "Exposed form in block" is "yes"
make sure the block "Exposed form: getlocations_search_nearby-page_1" is enabled in the sidebar.
Make sure it is configured with "Only the listed pages" set to "getlocations_search_nearby"
If you set "Exposed form in block" to "no" it will appear with the map.


All of the views may need to be limited to one or more content-types, depending on your use case.

To show phone,fax or mobile fields add Getlocations_fields: Data to your fields list and select the field you want from the dropdown.

An example of a PHP snippet in Getlocations Fields Distance / Proximity Filter
to provide the latitude/longitude of the current user as supplied by the
Smart IP module. See issue #1541620

if (isset($_SESSION['smart_ip']['location'])) {
  return array('latitude' => $_SESSION['smart_ip']['location']['latitude'], 'longitude' => $_SESSION['smart_ip']['location']['longitude']);
}


If you want to modify the dropdown of distance units in the Views Distance filter exposed form you will need to use hook_form_FORM_ID_alter()
in a helper module. In this example the helper module is called "myhelper" and it limits the distance units to Kilometers and Miles only:

function myhelper_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {

  // limit the search units to Miles and Kilometers
  if (isset($form['distance']['search_units']['#options'])) {
    $form['distance']['search_units']['#options'] = array('mi' => t('Miles'), 'km' => t('Kilometers'));
  }

  // change the search distance textfield into a dropdown
  if (isset($form['distance']['search_distance'])) {
    $form['distance']['search_distance']['#type'] = 'select';
    $form['distance']['search_distance']['#options'] = array(5 => '5', 10 => '10', 20 => '20');
    unset($form['distance']['search_distance']['#size']);
    unset($form['distance']['search_distance']['#required']);
  }

}

Theming.
Getlocations Fields pages can be themed by copying the relevant function to your theme's template.php,
renaming it in the usual manner.
eg
theme_getlocations_fields_show() becomes MYTHEME_getlocations_fields_show() where MYTHEME is the name of your theme.
You can edit it there to suit your needs.

These functions can be found in the file getlocations_fields.module

Theming the Getlocations Fields display.
This is done with function theme_getlocations_fields_show()

Theming the Getlocations Fields per instance settings form.
This is done with function theme_getlocations_fields_field_settings_form()

Theming the Getlocations Fields display settings form.
This is done with function theme_getlocations_fields_field_formatter_settings_form()

Theming the Getlocations Fields input form.
This is done with function theme_getlocations_fields_field_widget_form()

Theming the Getlocations Fields defaults settings form.
This is done with function theme_getlocations_fields_settings_form()

File

modules/getlocations_fields/README.txt
View source
  1. Views for Getlocations Fields
  2. Name: Getlocations
  3. Description: Provides a block with a link to a map.
  4. This view should work out of the box.
  5. Name: Getlocations map
  6. Description: Provides a map of a locations_fields enabled node.
  7. Configure contextual filter: Content: Nid
  8. Specify validation criteria
  9. Choose the content type
  10. Name: Getlocations map allnodes
  11. Description: Provides a map of all locations_fields enabled nodes.
  12. Name: Getlocations map nearby
  13. Description: Provides a map of all nearby locations_fields enabled nodes.
  14. To get this to work you will need to do some configuring:
  15. Configure contextual filter: Content: Nid
  16. Specify validation criteria
  17. Choose the content type
  18. Configure filter criterion: Getlocations Fields: Distance
  19. Make sure it is pointing to the right Location to use. You can also set the default Operator, Units and Distance.
  20. Configure extra settings for sort criterion Getlocations Fields: Distance
  21. Make sure it is pointing to the right Location to use.
  22. In Block 5 you will want to do the Format > Getlocations > Settings
  23. In Block 6 there is no further configuration required.
  24. You might want to try exposing the Pager, Distance or Order. Remember to set ajax to Yes
  25. Name: Getlocations show all
  26. Description: Provides a map of all locations_fields enabled content types.
  27. You will probably need to flush the cache to get the path 'getlocations_showall' accepted.
  28. Name: Getlocations map allusers
  29. Description: Provides a map of all locations_fields enabled users.
  30. Name: Getlocations User
  31. Description: Provides a link to a map of a locations_fields enabled user.
  32. This view should work out of the box.
  33. Name: Getlocations map nearby users
  34. Description: Provides a map of all nearby locations_fields enabled users.
  35. To get this to work you will need to do some configuring:
  36. Configure contextual filter: User: Uid
  37. Specify validation criteria
  38. Configure filter criterion: Getlocations Fields: Distance
  39. Make sure it is pointing to the right Location to use. You can also set the default Operator, Units and Distance.
  40. Configure extra settings for sort criterion Getlocations Fields: Distance
  41. Make sure it is pointing to the right Location to use.
  42. Name: Getlocations terms
  43. Description: Provides views for getlocations_fields enabled terms
  44. Name: Getlocations by city
  45. Description: Find locations by city in argument
  46. Path: /getlocations_by_city/nnn
  47. where nnn is the name or part of a city
  48. Name: Getlocations by postcode
  49. Description: Find locations by postcode in argument
  50. Path: /getlocations_by_postcode/nnn
  51. where nnn is the name or part of a postcode
  52. Name: Getlocations by province
  53. Description: Find locations by province in argument
  54. Path: /getlocations_by_province/nnn
  55. where nnn is the name or part of a province
  56. Name: Getlocations by country
  57. Description: Find locations by country in argument
  58. Path: /getlocations_by_country/nn
  59. where nn is the country code
  60. Name: Getlocations search nearby
  61. Description: Provides a map and form using Google Autocomplete search
  62. Path: /getlocations_search_nearby
  63. The exposed form contains a Google Autocomplete textbox, Unit selector and Distance textbox.
  64. This form can be configured to appear with the page or in a block.
  65. In the View, under "Advanced", if "Exposed form in block" is "yes"
  66. make sure the block "Exposed form: getlocations_search_nearby-page_1" is enabled in the sidebar.
  67. Make sure it is configured with "Only the listed pages" set to "getlocations_search_nearby"
  68. If you set "Exposed form in block" to "no" it will appear with the map.
  69. All of the views may need to be limited to one or more content-types, depending on your use case.
  70. To show phone,fax or mobile fields add Getlocations_fields: Data to your fields list and select the field you want from the dropdown.
  71. An example of a PHP snippet in Getlocations Fields Distance / Proximity Filter
  72. to provide the latitude/longitude of the current user as supplied by the
  73. Smart IP module. See issue #1541620
  74. if (isset($_SESSION['smart_ip']['location'])) {
  75. return array('latitude' => $_SESSION['smart_ip']['location']['latitude'], 'longitude' => $_SESSION['smart_ip']['location']['longitude']);
  76. }
  77. If you want to modify the dropdown of distance units in the Views Distance filter exposed form you will need to use hook_form_FORM_ID_alter()
  78. in a helper module. In this example the helper module is called "myhelper" and it limits the distance units to Kilometers and Miles only:
  79. function myhelper_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
  80. // limit the search units to Miles and Kilometers
  81. if (isset($form['distance']['search_units']['#options'])) {
  82. $form['distance']['search_units']['#options'] = array('mi' => t('Miles'), 'km' => t('Kilometers'));
  83. }
  84. // change the search distance textfield into a dropdown
  85. if (isset($form['distance']['search_distance'])) {
  86. $form['distance']['search_distance']['#type'] = 'select';
  87. $form['distance']['search_distance']['#options'] = array(5 => '5', 10 => '10', 20 => '20');
  88. unset($form['distance']['search_distance']['#size']);
  89. unset($form['distance']['search_distance']['#required']);
  90. }
  91. }
  92. Theming.
  93. Getlocations Fields pages can be themed by copying the relevant function to your theme's template.php,
  94. renaming it in the usual manner.
  95. eg
  96. theme_getlocations_fields_show() becomes MYTHEME_getlocations_fields_show() where MYTHEME is the name of your theme.
  97. You can edit it there to suit your needs.
  98. These functions can be found in the file getlocations_fields.module
  99. Theming the Getlocations Fields display.
  100. This is done with function theme_getlocations_fields_show()
  101. Theming the Getlocations Fields per instance settings form.
  102. This is done with function theme_getlocations_fields_field_settings_form()
  103. Theming the Getlocations Fields display settings form.
  104. This is done with function theme_getlocations_fields_field_formatter_settings_form()
  105. Theming the Getlocations Fields input form.
  106. This is done with function theme_getlocations_fields_field_widget_form()
  107. Theming the Getlocations Fields defaults settings form.
  108. This is done with function theme_getlocations_fields_settings_form()