I'm using Drupal 7 and Clean theme. And i have got a map. That's javascript codes. I created map field in my content type and want import this javascript in node.

How can i do?


hook_node_view_alter() will make sure that a node is being prepared for edit before to be rendered for view.


function MODULE_node_view_alter(&$build){
   $build['mymap'] = array(
       '#markup' => 'Your JS Code',
| improve this answer | |

Alternatively use hook_node_view_alter() and drupal_add_js()

drupal_add_js('path/to/file.js', 'file');
| improve this answer | |

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.