Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-12T13:26:17.500Z
Answers.Text: Arrgh! I thought it would be this but stupidly tried including quotes in the object property.
Answers.UserDisplayName: hamishtaplin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-11T17:14:25.543Z
Answers.LastActivityDate: 2015-03-11T17:14:25.543Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <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>
  
Tags: <plugin-development>
Title: Mapping plugin settings to checkboxes
ThreadText: # 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: "<strong>Twitter</strong>"|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: "<strong>Twitter</strong>"|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.  
  
  ---
  
  