6

You can also use the #access check to keep people from seeing the vertical tabs. $form['additional_settings']['#access'] = FALSE; Simply add that to a hook form alter or in between the loading and the rendering of a form. After that you can call render($form) to get the markup.


5

And the answer: $entity_metadata_wrapper = entity_metadata_wrapper('node', $node_object); $data = array( 'lat' => 44, 'lon' => -93 ); $entity_metadata_wrapper->field_position->set($data);


5

Nigel Waters has it correct. Here are the details. I did this for cities and states. I used points for cities and polygons for states. Here are the steps. Requirements: Geofield module Leaflet module Leaflet Views module (a submodule of Leaflet) Steps: Create the two content types: City and State. Create a field of type Geofield, call it "Location" ...


4

I have been able to accomplish this task following these steps: Installed modules for search: search_api, search_api_location, search_api_solr search_api_views, search_api_facetapi, Search API location views Installed modules for "geosearch": geofield (to store lat, lon...), addressfield (make it easier for users to enter an address and don't worry about ...


4

According to README.TXT: API NOTES Geofield fields contain nine columns of information about the geographic > data that is stores. At its heart is the 'wkt' column where it stores the full geometry in the 'Well Known Text' (WKT) format. All other columns are metadata derived from the WKT column. Columns are as follows: 'geom' Raw ...


4

I have created a working sandbox version of address autocomplete. https://drupal.org/sandbox/adammitchell/2126989. I will endeavour to get it created into a full blown project. However if you could help me and test it that would be greatly appreciated.


4

Set Geofield using EntityMetadataWrapper if you only have the Longitude & Latitude information. (2015): $geofield_data = geofield_compute_values(array( 'lat' => [Latitude], 'lon' => [Longitude] ), GEOFIELD_INPUT_LAT_LON); $entity_metadata_wrapper->field_position->set($geofield_data); When a geofield is saved using ...


4

I had a similar issue with editing the exposed form. Form alter is not the right way to go though. You'll need to use element info alter. Take a look at this custom module I threw together for editing the geofield proximity search. You can see what I did, and add/modify functionalities for your needs (although I think i did exactly what you wanted).


4

If you have an array of nids you could just run this piece of code example will unpublish the nodes with nid 1,2,3: $nids = array(1, 2 ,3); foreach($nids as $nid) { db_query("UPDATE {node} SET `status` = '0' WHERE `nid` =:nid ;" ,array(':nid'=> $nid)); } entity_get_controller('node')->resetCache($nids);


3

With the first solution, the country key is missing, so you can't save this country field because the country key doesn't match. I suggest that (similar to the second solution) : function hook_countries_alter(&$countries) { $country_key = 'FR';//eg. your country key $country_data = $countries[$country_key]; unset($countries[$country_key]); $...


3

This works, but (here's the trick), only if you enable the location_entity module, which ships with location. $location = array( 'latitude' => $latitude, 'street' => $street, // etc, other elements added here ... ); $ew->field_location->set($location); $ew->save(); May no one else lose as much time on this ever again.


3

Geolocation Proximity seems to be exactly a solution for you. You will need to keep location data using Geolocation Field to benefit from it. Current features are: Views filter that can be used to filter entities (nodes, users, etc.) based on distance from a certain point (defined as lat/lng point). The input widget is very basic at the moment. ...


3

In short : Use the Location Distance field in Views. In detail : Check out the video http://www.youtube.com/watch?v=AxeskzN8BAc


3

You will need custom coding to provide the argument to the view, but you could use the following modules for the geolocation functionality: Feature-rich, server-side solution: Smart IP Simpler, ip-based server/client-side solution: geoPlugin


3

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 filters. The only way to enable this is by enabling the Use AJAX setting on the block view under the Advanced section in the admin UI. Once set, both the block &...


3

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 = \Drupal\Core\Locale\CountryManager::getStandardList(); foreach ($countries as $key => $value) { $country_name = (string) $value; print "$key - $...


2

I wrote a simple possible solution in the already mentioned thread: https://drupal.org/node/1048644#comment-7822687. For convenience, I'll paste it here. There's a simple way to disable vertical tabs on a form, by simply changing the $form['additional_settings']['#type'] variable's value to 'fieldset' in an implementation of hook_form_alter() or ...


2

Using values like this, I was able to update a geofield's data programatically: PHP $lat = 42.281646; $lon = -83.744222; $geofield = array( 'geom' => "POINT ($lon $lat)", 'geo_type' => 'point', 'lat' => $lat . "000000", 'lon' => $lon . "000000", 'left' => $lon . "000000", 'top' => $lat . "000000", 'right' => $lon . "...


2

For the benefit of others who stumble on this question in future - If you are using a Drupal 7 site, then you can use Location and Gmap modules for this. To allow picking of coordinates from a map you would have to edit the location module settings at admin/config/content/location and CHECK the option for using a google map as shown below


2

This sort of thing is generally handled through contextual filters in your view. Views, Panels and Page Manager work well together to manage passing contextual filters to a view for filtered output, but there is a bit of a learning curve involved. I'm not generally one for video tutorials, but I found this one to be a good introduction to this methodology: ...


2

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 is not at present an Input Widget Switcher module for Drupal 7 or earlier, but there really needs to be. There are similar modules such as Display Suite for ...


2

Another approach is simply using CSS. The select list is built like this: <select> <option value="6371">Kilometres</option> <option value="6371000">Metres</option> <option value="3959">Miles</option> <option value="6975175">Yards</option> <option value="20925525">Feet</option> &...


2

Smart IP module (https://drupal.org/project/smart_ip) will do the job. It will locate the visitor based on his/her IP address. Anything better than that (e.g. street address) requires Device Geolocation, which comes as a submodule of Smart IP.


2

Geofield module is rather complex module which adds a lat/long fieldset and so many other stuff such as adding new fields, validation, etc. Anyway, you can create a latitude and longitude input field using the #type => 'geofield_latlon'. $form['geofield'] = array( '#title' => 'geofield', '#type' => 'geofield_latlon', ); Note that this will ...


2

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['additional']['#title'] = "Address line 2"; }


2

To answer my own question is to use the same field on both content types. I used a geojson (geofield) field which accepts both points and polygons to merge into a single leaflet map in views.


2

Should anyone else have this problem, the correct answer is: { "node": { "field_restaurant_location": { "und": [ { "country": "us", "latitude": "-26.2041", "locpick": { "user_latitude": "-26.2041", "...


2

Something like function yourmodule_form_alter(&$form, &$form_state, $form_id) { if (($form_id == 'views_exposed_form') && ($form['#id'] == 'views-exposed-form-your-view')) { $form['proximity']['default_radius']['#type'] = 'select'; $form['proximity']['default_radius']['#options'] = array(10, 20, 30); $form['proximity']['...


2

Just some ideas: I remember a WordPress multilanguage plugin setting that I had the option Detect the language of the browser and redirect accordingly. That must work similar for Drupal. So, I'ld guess you would try that browser language approach. D6 even had an own function for this language_from_browser. I bet there must be something in D7 for that as ...


2

Thanks to @joemurray for pointing me in the right direction. This is my function to grab the closest nid to my target nodes lat, long. /** * * Load the nid we are interested in for this report taken from the page we are on. * [http://funkjedi.com/technology/308-search-using-geolocation-data-in-mysql/][1] */ function _load_proximity_nids($lat, $lon) { $...


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