Skip to main content
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
  • 102k
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

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
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,574
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

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,186
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,343
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
  • 168k
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
  • 815
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

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