引用另一个模块中的模块

时间:2017-08-03 07:37:53

标签: javascript drupal-7 drupal-modules

我创建了一个模块'one_time_popup',我想调用模块'home_landing_page',它有我所需的js'service.js' 我想用home_landing_page模块中的service.js来运行。我想在one_time_popup模块中调用service.js函数

one_time_popup.info
name = onetimepopup
description = Get my details from soap service
package = onetimepopup Services
core = 7.x
version = "7.x-3.0"
files[] = one_time_popup.module
dependencies[] = home_landing_page

home_landing_page.js
name = Site Homepage
description = Provides a homepage for the site for anonymous and authenticated users
core = 7.x
package = Landing pages
php = 5.2.4
project = home_landing_page
scripts[] =restservice.js
scripts[] =service.js

service.js
 function sendRequest() {}
 function sendRequestCall() {}

one_time_popup.module
if (module_exists('home_landing_page')) { 
  want to call service.js
}

1 个答案:

答案 0 :(得分:0)

请试试这个,



if (module_exists('module_name')) { 
    module_name_function_name();
  }