addJs with parameter

Hey there,

After an update of October cms to version 2.2.15 the addJs method seems to ignore the added parameters. The documentation says:

public void addJs($name, $attributes=array())

Is this attributes argument for adding parameters?

I have this code here:

$this->addJs('assets/js/multi_captcha.js', http_build_query($params));

The outcome then looks like this:

<script src=""></script>

Unfortunately, there aren’t any parameters added here. What can I do better?

UPDATE: The $params by the way is an array. It is build like that:

$params = [
    'site-key' => (isset($multicaptcha['site_key'])) ? $multicaptcha['site_key'] : '',
    'locale' => $locale

Hi! The $attributes property is not for the query string. It is used for html element attributes.


$this->addJs('assets/js/app.js', ['defer' => true])

Outputs to:

<scripts defer="true" src=""></script>

If you want to add query parameters try this:
'assets/js/multi_captcha.js?' . http_build_query($params)