# How to do multiple values properly in decorate widget javascript?

**URL:** https://meta.discourse.org/t/how-to-do-multiple-values-properly-in-decorate-widget-javascript/52623
**Category:** Support
**Created:** [7 Novembre 2016, 3:47pm UTC](https://meta.discourse.org/t/how-to-do-multiple-values-properly-in-decorate-widget-javascript/52623 "2016-11-07T15:47:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yyhmsg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yyhmsg/32/115542_2.png) [@yyhmsg](https://meta.discourse.org/u/yyhmsg)
#### Post date: [7 Novembre 2016, 3:47pm UTC](https://meta.discourse.org/t/how-to-do-multiple-values-properly-in-decorate-widget-javascript/52623/1 "2016-11-07T15:47:22Z")

</div>

I feel silly even asking this, but I’ve tried every variation I know of and my javascript is not strong… Anyhow, I’m trying to add multiple menu items to the hamburger menu via the api.decorateWidget function.

I’ve tried this:

```plaintext
 <script type="text/discourse-plugin" version="0.4">
      api.decorateWidget('hamburger-menu:generalLinks', () => {
        return [{ href: 'https://yinyanghouse.com/', rawLabel: 'Our Blog' }, { href: 'https://store.yinyanghouse.com', rawLabel: 'Our Store'}];
      });
    </script>

```

But that doesn’t show up – doing it like this does work:

```plaintext
<script type="text/discourse-plugin" version="0.4">
  api.decorateWidget('hamburger-menu:generalLinks', () => {
    return { href: 'https://yinyanghouse.com/', rawLabel: 'Our Blog' };
  });
  api.decorateWidget('hamburger-menu:generalLinks', () => {
    return { href: 'https://store.yinyanghouse.com/', rawLabel: 'Our Store' };
  });
  
</script>

```

But it seems like there should be a way to put those into an array and return that?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [7 Novembre 2016, 5:12pm UTC](https://meta.discourse.org/t/how-to-do-multiple-values-properly-in-decorate-widget-javascript/52623/2 "2016-11-07T17:12:48Z")

</div>

You’re right, this is actually somewhat confusing. I’ve fixed it in this commit:

[https://github.com/discourse/discourse/commit/bc2c6b0918c10467d40aa690919917d9090c7b84](https://github.com/discourse/discourse/commit/bc2c6b0918c10467d40aa690919917d9090c7b84)

So if you are running the latest version of Discourse you can now use an array. If not, your solution if calling `decorateWidget` twice will work.

---

<div class="post-metadata">

### Author: ![yyhmsg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yyhmsg/32/115542_2.png) [@yyhmsg](https://meta.discourse.org/u/yyhmsg)
#### Post date: [8 Novembre 2016, 2:31am UTC](https://meta.discourse.org/t/how-to-do-multiple-values-properly-in-decorate-widget-javascript/52623/3 "2016-11-08T02:31:53Z")

</div>

Awesome! Thanks for the quick fix!

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [8 Novembre 2016, 9:05am UTC](https://meta.discourse.org/t/how-to-do-multiple-values-properly-in-decorate-widget-javascript/52623/4 "2016-11-08T09:05:32Z")

</div>


