0

I've been trying to figure how I can fetch the latitude and longitude values using geolocation field and display it on my node.html.twig template.

I've been using to kint() to see how I would be able to fetch but I can't seem to figure out the right syntax. It seems to be inside an array

Tried node.field_geolocation.latitude.value or node.field_geolocation.longitude.value

enter image description here

enter image description here

  • 1
    Have you tried {{ node.field_geolocation['x-default']['lat'] }} or {{ content.field_geolocation['x-default']['lat'] }}? – leymannx Oct 15 '18 at 13:04
1

I did this by printing, {{ node.field_geolocation.lat }} and {{ node.field_geolocation.lng }}.

That should print the values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.