0

I have tried render only two array´s parameters. Street and postal code but don´t display anything this code.

<?php print render($content['field_mapa']['und'][0]['street']); ?>and <?php print render($content['field_mapa']['und'][0]['city']); ?>

However with this code print all parameters.

<?php  print render($content['field_mapa']); ?>

I don´t understand where is the problem with this field.

2
  • do you work with subfields module?
    – berramou
    Commented Jan 23, 2019 at 9:24
  • No, only location field. Show the nodes in a view with a custom teaser template. And in this teaser i try to print render the street and postal code of this location field. However if i make print render $content about the field complete display all values of this location field. Commented Jan 23, 2019 at 11:41

1 Answer 1

0

The location field module wrap fields inside #location so try with :

<?php print render($content['field_mapa'][0]['#location']['street']); ?>

and

<?php print render($content['field_mapa'][0]['#location']['city']); ?>
3
  • Thanks, i´m going to test this, but look like that this WORKS !!!! Thank you Berramou and 4k4 for edit the post. Commented Jan 23, 2019 at 19:13
  • i'm glad that help, mark the answer as the accepted, in case someone needs it in the future.
    – berramou
    Commented Jan 23, 2019 at 20:58
  • Ok, i´m new here and i´m learn the structure. Sorry Commented Jan 23, 2019 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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