function ctools_attach_js
Format a javascript file name for use with $form['#attached']['js'].
This helper function is used by ctools but can also be used in other modules in the same way as explained in the comments of ctools_include.
$form['#attached']['js'] = array(
ctools_attach_js('auto-submit'),
);
Parameters
$file: The base file name to be included.
$module: Optional module containing the include.
$dir: Optional subdirectory containing the include file.
Return value
string A string containing the appropriate path from drupal root.
5 calls to ctools_attach_js()
- CtoolsModuleTestCase::testAttachJs in tests/
ctools.test - Test the ctools_attach_js function returns the expected paths.
- ctools_dependent_pre_render in includes/
dependent.inc - ctools_export_ui::list_form in plugins/
export_ui/ ctools_export_ui.class.php - Create the filter/sort form at the top of a list of exports.
- ctools_jump_menu in includes/
jump-menu.inc - Generate a jump menu form.
- page_manager_list_pages_form in page_manager/
page_manager.admin.inc - Provide a form for sorting and filtering the list of pages.
File
-
./
ctools.module, line 268
Code
function ctools_attach_js($file, $module = 'ctools', $dir = 'js') {
return drupal_get_path('module', $module) . "/{$dir}/{$file}.js";
}