Alright, so I have two files which should be added to a module. This is the way I do it:
$form['display']['#attached'] = array(
'js' => array(
array('data' => drupal_get_path('module', 'test_module') . '/js/test_module.js'),
array('data' => drupal_get_path('module', 'test_module') . '/js/common.js'),
),
);
Now my test_module.js file looks like this:
(function ($) {
Drupal.behaviors.test_module = {
attach: function(context) {
console.log(Drupal.settings);
}
}});
And js works fine because I get data from Drupal.settings object. However, the second one is totaly the same and console.log does not work. Here's how it looks:
(function ($) {
Drupal.behaviors.test_module = {
attach: function(context) {
console.log("test data");
}
}});
Why the second file does not work?