Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Commit

Permalink
Added comments, about ported hooks and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
afi13 committed Feb 5, 2016
1 parent b974a89 commit 25c0cc9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 12 additions & 6 deletions d7/sites/all/modules/contrib/location/location.inc
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,11 @@ function location_province_code($country = 'us', $province = 'xx') {
// @@@ New in 3.x, document.
/**
* PORTED to 8.x-1.x - \Drupal\dmaps\LocationCountriesManager
* \Drupal::service('dmaps.geocoder')->setStdCountryCode();
*
* Canonicalize a country code.
*/
function location_standardize_country_code(&$country) {
// @d8 location_standardize_country_code() -> \Drupal::service('dmaps.geocoder')->setStdCountryCode();
$country = trim($country);
// @@@ Double check the validity of this validity check. ;)
if (!ctype_alpha($country) || strlen($country) != 2) {
Expand All @@ -706,6 +707,8 @@ function location_standardize_country_code(&$country) {

/**
* PORTED to 8.x-1.x - \Drupal\dmaps\LocationCountriesManager
* \Drupal::service('dmaps.geocoder')->getCountry();
*
* Load support for a country.
*
* This function will load support for a country identified by its two-letter ISO code.
Expand All @@ -717,7 +720,6 @@ function location_standardize_country_code(&$country) {
* TRUE if the file was found and loaded, FALSE otherwise.
*/
function location_load_country($country) {
// @d8 location_load_country() -> \Drupal::service('dmaps.geocoder')->getCountry();
location_standardize_country_code($country);

$file = DRUPAL_ROOT . '/' . drupal_get_path('module', 'location') . '/supported/location.' . $country . '.inc';
Expand All @@ -732,14 +734,17 @@ function location_load_country($country) {

// @@@ New in 3.x, document.
/**
* PORTED to 8.x-1.x - \Drupal::service('dmaps.geocoder')->initGeocoder();
*
* Load a general geocoding service.
*/
function location_load_geocoder($geocoder) {
// @d8 location_load_geocoder() -> \Drupal::service('dmaps.geocoder')->initGeocoder();
include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'location') . '/geocoding/' . $geocoder . '.inc';
}

/**
* PORTED to 8.x-1.x - \Drupal::service('dmaps.geocoder')->getAddrSingleline();
*
* Create a single line address.
*
* @param array $location
Expand All @@ -749,7 +754,6 @@ function location_load_geocoder($geocoder) {
* The single line address
*/
function location_address2singleline($location = array()) {
// @d8 location_address2singleline() -> \Drupal::service('dmaps.geocoder')->getAddrSingleline();
// Check if its a valid address.
if (empty($location)) {
return '';
Expand Down Expand Up @@ -798,10 +802,11 @@ function location_address2singleline($location = array()) {
}

/**
* PORTED to 8.x-1.x - \Drupal::service('dmaps.geocoder')->getGeocoders();
*
* Geocoder list.
*/
function location_get_general_geocoder_list() {
// @d8 location_get_general_geocoder_list() -> \Drupal::service('dmaps.geocoder')->getAddrSingleline();
$list = & drupal_static(__FUNCTION__, array());

if (!count($list)) {
Expand All @@ -820,13 +825,14 @@ function location_get_general_geocoder_list() {

/**
* PORTED to 8.x-1.x - \Drupal\dmaps\LocationCountriesManager
* location_get_iso3166_list() -> \Drupal::service('dmaps.geocoder')->getIso3166List();
*
* The following is an array of all.
*
* countrycode => country-name pairs as layed out in
* ISO 3166-1 alpha-2
*/
function location_get_iso3166_list($upper = FALSE) {
// @d8 location_get_iso3166_list() -> \Drupal::service('dmaps.geocoder')->getIso3166List();
include_once DRUPAL_ROOT . '/includes/locale.inc';

// Statically cache a version of the core Drupal list of countries
Expand Down
4 changes: 3 additions & 1 deletion d7/sites/all/modules/contrib/location/location.module
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ define('LOCATION_USER_COLLECT', 1);
include_once DRUPAL_ROOT . '/' . LOCATION_PATH . '/location.inc';

/**
* partially PORTED to Dmaps 8.x-1.x: dmaps.routing.yml
*
* Implements hook_menu().
*/
function location_menu() {
Expand Down Expand Up @@ -98,7 +100,7 @@ function location_api_variant() {
}

/**
* PORTED to Dmaps 8.x-1.x
* PORTED to Dmaps 8.x-1.x: dmaps.permissions.yml
*
* Implements hook_permission().
*/
Expand Down

0 comments on commit 25c0cc9

Please sign in to comment.