I’m new to Drupal and don’t really understand how to set up drupal_add_library.
I’ve made a simple module that links out to a .js file. However, this .js file depends on a couple of generic functions. I’ve put this generic functions in a library and want to call them.
I’ve set up my code as such:
function products_preprocess_page(&$variables) { drupal_add_library($module, $name); drupal_add_js(drupal_get_path('module', 'products') . '/assets/myScript.js'); }
But am not sure what to put in $module and $name (I’m assuming name is the actual name of the .js you want to call from the library), or even if this is the right place to call it.
Can anyone point me in the right direction?