Skip to main content

How to set geolocation field programmatically in drupal 8 [example]

Setting the proper values at a geolocation field programmatically in drupal 8 is different from typical field values. This code will do the trick: 'location', 'title' => 'Attraction Location', 'geolocation_cords_field' => ['lat'=> 36.386122, 'lng' => 25.428413] ); $node->save(); ?>
geolocation