3 votes
Accepted

How to get country list array with their corresponding country codes

You get the infinite loop, because the country name is a translatable markup and print_r() can't handle this object. If you cast the country name to a string, then it is printable in php: $countries ...
4uk4's user avatar
  • 99.8k
3 votes
Accepted

How can I pass the filter parameters of one view to a different view on the same page?

Yes, it's possible to have 2 different views on the same page sharing the same exposed filter query parameters. The trouble you're having is, by default, a block display doesn't show any exposed ...
Shawn Conn's user avatar
  • 26.9k
2 votes

How do I modify default labels of the location module?

https://www.drupal.org/node/381458#comment-6699162 worked for me /** * Implements hook_location_element_alter(). */ function update_personal_info_location_element_alter(&$element) { $element['...
TechNikh's user avatar
  • 171
2 votes
Accepted

How do I implement georeferencing?

Have a look at the IP Geolocation Views & Maps module. Partial quote from its project page: Despite what the name may suggest, IP Geolocation Views & Maps (IPGV&M) is first and foremost a ...
Pierre.Vriens's user avatar
2 votes

How do I implement georeferencing?

If you want to use an existing module - something like GMap is probably the easiest place to start. That being said, the Google Map API is fairly easy to use, so nothing preventing you from writing a ...
JP Dippenaar's user avatar
2 votes

How to export GMap configurations?

I found from my seniors that these configurations (in this case GMap configurations) are stored in variables and Strongarm module can be utilised to export them. After enabling Strongarm module, these ...
user3919682's user avatar
2 votes

How to display visitor's country flag depending on the visitor's IP address?

The Smart IP module can give you the user's IP address. The following code should give you a block, assuming you have flag images whose file names match the country code, e.g. "ie.png" for Ireland and ...
Frank H.'s user avatar
  • 804
2 votes

Set up Node content 'localization' / site wide region filter - similar to languages idea

There are two 'out of the box' solutions. The one is to use taxonomies to classify your content in different zones (one for the default zone), and views to decide when to display what. All you ...
JP Dippenaar's user avatar
2 votes

How to get country list array with their corresponding country codes

$countries = \Drupal\Core\Locale\CountryManager::getStandardList(); foreach ($countries as $key => $value) { $countries[$key] = $value->__toString(); } $countries will return the array.
harsh_behl_0007's user avatar
2 votes

Dynamically change widget type in node edit form

The use case you describe is specific in nature, but the question you actually asked in the title is more general purpose. I’m answering the question in the title. To the best of my knowledge, there ...
Joel MMCC's user avatar
  • 141
2 votes

How to show the distance relative to the user's location?

You need to install the Geolocation Field module and the example submodule that comes with it. In the examples you will find a view that made exactly what you need, and you only will need to clone ...
Adrian Cid Almaguer's user avatar
2 votes
Accepted

Geolocation Field - Map Marker in Views

You need to create a display in your content type where you will put the field that you want to show in the tooltip. Home » Administration » Structure » Content types » YOUR CONTENT TYPE » Manage ...
Adrian Cid Almaguer's user avatar
2 votes
Accepted

How to send a custom Solr Distance Query with SearchApi

Debugging around I found the solution: $index = Index::load('default_solr_index'); /* @var \Drupal\search_api\Query\Query $query */ $query = $index->query(); $query->keys($form_state->...
Rainer Feike's user avatar
  • 2,566
2 votes

Programmatically set latitude and longitude exposed input

I finally figured out how its supposed to be formatted. Kinting after the view execute rather than before exposed the field names. $exposed = [ 'center' => [ 'coordinates' => [ 'lat' ...
Ronnie's user avatar
  • 487
1 vote
Accepted

Is it safe to remove all untranslated strings?

Instead of a one-time deletion, I would periodically export your important strings to code. This is easy to script and means you will always have a backup if deletion goes wrong or a translator makes ...
Patrick Kenny's user avatar
1 vote

The geographic data (latitude, longitude) isn't saved in content

Geofield module doesn't work without the GeoPHP library. You need to download both the module and the library and place them in the correct locations in order for the module to work. When using ...
prkos's user avatar
  • 7,131
1 vote
Accepted

How can I get lat/lon from an address?

Using google geocoding with geocoder module, you may use another geocoding provider, i think this requires a google map token now given google's new rules : // @return Geometry Returns a geoPHP ...
Oulalahakabu's user avatar
  • 1,313
1 vote
Accepted

How to filter users based on address location?

I believe this is what you are looking for https://www.drupal.org/node/1944648
saad waseem's user avatar
1 vote

How to filter users based on address location?

You can use geolocation_proximity
Saurabh Vijayvargiya's user avatar
1 vote

Lat/Long not getting imported into Geofield via feeds importer

There is a bug in the Geofield module. When lat/long are set via Feeds, the Geofield module assumes the field to be empty because some other properties of the field are not set. There is a patch ...
MegaChriz's user avatar
  • 800
1 vote

Smart IP doesn't show countries

To address your edit about the Views filter requirement, there's a submodule included with the main module, called "Smart IP Views Bridge". It has the functionality you're looking for. An ...
Clive's user avatar
  • 167k
1 vote
Accepted

Taking node map from /map/node and using it on home page

Just create an appropriate view, give that view some path that you like, and set that path as your homepage. To actually create such view with the kind of data your question is about, have a look at ...
Pierre.Vriens's user avatar
1 vote

Add location to to profile2 just after the user registers

Try using hook_user_insert instead. The $account will have $account->uid set at that stage. P.S wrapping hook_user_presave in that condition looks wrong and probably won't work with the hook ...
David Thomas's user avatar
  • 21.9k
1 vote

Manage display of geofield with wkt input widget

Some suggestions: make sure that you edit the right format when you filled in the wkt. check for any errors in the installation of the map. I had the same problems in the beginning with mapping too. ...
Lucy's user avatar
  • 56
1 vote

Does Gmap work with geofield?

Maybe you should investigate to what extend the IP Geolocation Views & Maps module could help you. Partial quote from its project page: Despite what the name may suggest, IP Geolocation Views &...
Pierre.Vriens's user avatar
1 vote

Location Module fields are not available under Search api fields

As pointed out here, you can achieve that by means of a combination of modules: Search API Location + Search API Solr + Location field (creating an aggregated location field). You will need an extra ...
bmunslow's user avatar
  • 359
1 vote

How to make address1 field and zip code non required with Address Field module

I would use form_alter to hook into the form, identify the form element and unset or make required FALSE eg: mymodule_form_alter(&$form, &$form_state, $form_id){ if($form_id == 'xyz'){ ...
Euan Fergusson's user avatar
1 vote

How to reduce options for units of measurement to just miles and km for proximity search

This isn't really in the form, via hook_form_alter(). It's an element of a form component, so you really need to implement hook_element_info_alter(), and add a "process" callback to the stack. In ...
chrisfromredfin's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible