1

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?

0

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

e.g.

function MODULE_node_view_alter(&$build){
   $build['mymap'] = array(
       '#markup' => 'Your JS Code',
   );
}
1

Alternatively use hook_node_view_alter() and drupal_add_js()

drupal_add_js('path/to/file.js', 'file');

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.