<p>Sure:</p>

<pre><code>{{  forms.checkboxField({
      label: "&lt;strong&gt;Twitter&lt;/strong&gt;"|t,
      name: 'createGlobals[twitter]',
      value : 'on',
      checked: settings.createGlobals.twitter
}) }}
</code></pre>

CC BY-SA 3.0
2015-03-12T13:26:17.500Z
Arrgh! I thought it would be this but stupidly tried including quotes in the object property.
hamishtaplin
CC BY-SA 3.0
2015-03-11T17:14:25.543Z
2015-03-11T17:14:25.543Z
Mats Mikkel Rummelhoff
<p>I'm struggling to figure out how to map an array of values in a plugins settings to a group of checkboxes:</p>

<pre><code>protected function defineSettings()
{
    return array(
        'createGlobals' =&gt; array(
            AttributeType::Mixed, 'default' =&gt; array(
                "twitter" =&gt; true,
                "facebook" =&gt; true,
                "linkedIn" =&gt; true
                )
            )
        );
}
</code></pre>

<p>Here's one checkbox in my plugins template:</p>

<pre><code>{{  forms.checkboxField({
  label: "&lt;strong&gt;Twitter&lt;/strong&gt;"|t,
  name: '???',
  value: 'on',
  checked: settings.createGlobals.twitter
}) }}
</code></pre>

<p>As you can see, I've omitted the name value. Is there any way of mapping this name to the settings.createGlobals object?</p>

<plugin-development>
Mapping plugin settings to checkboxes
# Mapping plugin settings to checkboxes

(Asked by: username_0 on 2015-03-11)

I'm struggling to figure out how to map an array of values in a plugins settings to a group of checkboxes:
protected function defineSettings()
{
    return array(
        'createGlobals' => array(
            AttributeType::Mixed, 'default' => array(
                "twitter" => true,
                "facebook" => true,
                "linkedIn" => true
                )
            )
        );
}

Here's one checkbox in my plugins template:
{{  forms.checkboxField({
  label: "Twitter"|t,
  name: '???',
  value: 'on',
  checked: settings.createGlobals.twitter
}) }}

As you can see, I've omitted the name value. Is there any way of mapping this name to the settings.createGlobals object?

**Tags:** plugin-development


---

## 1 answers

### Answer by username_1 on 2015-03-11. Score: 4 | Accepted answer

Sure:
{{  forms.checkboxField({
      label: "Twitter"|t,
      name: 'createGlobals[twitter]',
      value : 'on',
      checked: settings.createGlobals.twitter
}) }}

> **Comments:**
> **username_0**: Arrgh! I thought it would be this but stupidly tried including quotes in the object property.  

---

