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?



{{  forms.checkboxField({
      label: "<strong>Twitter</strong>"|t,
      name: 'createGlobals[twitter]',
      value : 'on',
      checked: settings.createGlobals.twitter
}) }}
| improve this answer | |
  • Arrgh! I thought it would be this but stupidly tried including quotes in the object property. – hamishtaplin Mar 12 '15 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.