Hi.
When creating a new field ("integer", "single on/off checkbox") I get an error (see screenshot) because the default value of the checkboxes is not set correct (it is set to '' but expects an array).

This is due to the fact you're using isset instead of !empty.
accepted_limits.module

<?php
      $form['accepted_limits']['accepted_limit_display'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Message display'),
        '#description' => t('Specify when to display the warning messages.'),
        '#default_value' => isset($field['accepted_limit_display']) ? $field['accepted_limit_display'] : array('submit', 'edit'),
        '#options' => array(
          'submit' => t('When submitting'),
          'edit' => t('When editing'),
        ),
?>

If you change this to

<?php
        '#default_value' => !empty($field['accepted_limit_display']) ? $field['accepted_limit_display'] : array('submit', 'edit'),
?>

the module works without the error message.

Unfortunately I can't create a patch at the moment so you need to fix this by hand (or I upload a patch later today :) ).

Thanks,

Stefan

Comments

stborchert’s picture

Status: Active » Needs review
StatusFileSize
new960 bytes

Here is the patch.

vkareh’s picture

Status: Needs review » Fixed

Committed to the new development snapshot! Thanks!!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.