Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
My custom module attaches extra js as follows.
function MYMODULE_form_webform_client_form_alter(&$form, &$form_state) {
$form['#attached']['js'] = array(drupal_get_path('module', 'MYMODULE') . '/js/MYMODULE.js',);
}
When this module is enabled, webform.js is not loaded. Looks like a bug - unless I have overlooked a documented workaround?
Comments
Comment #1
DanChadwick CreditAttribution: DanChadwick commentedYou are overwriting webform's #attached. Use [] = to append rather than = array() to overwrite.
The bug is in your code.
Comment #2
John_B CreditAttribution: John_B commentedMany thanks