Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
Problem/Motivation
Was getting this error message:
Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value() (line 2337 of html/includes/form.inc).
Traced it back to:
Default is not an array.
array ( '#type' => 'checkboxes',
'#title' => 'Demo regions',
'#options' => array ( 'navigation' => 'Navigation', 'header' => 'Header', 'help' => 'Help', 'content' => 'Content', 'sidebar_first' => 'Primary Sidebar', 'sidebar_second' => 'Secondary Sidebar', 'footer' => 'Footer', ),
'#default_value' => '', // THIS needs to be an array.
'#input' => true, '#process' => array ( 0 => 'form_process_checkboxes', ), '#theme_wrappers' => array ( 0 => 'checkboxes', ), '#pre_render' => array ( 0 => 'form_pre_render_conditional_form_element', 1 => 'ctools_dependent_pre_render', ), '#defaults_loaded' => true, '#tree' => false, '#disabled' => false, '#parents' => array ( 0 => 'omega_demo_regions_list', ), '#array_parents' => array ( 0 => 'omega', 1 => 'development', 2 => 'settings', 3 => 'omega_demo_regions_list', 4 => 'omega_demo_regions_list', ), '#weight' => 0, '#processed' => false, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#id' => 'edit-omega-demo-regions-list--2', '#name' => 'omega_demo_regions_list', )
Proposed resolution
Cast the value to an array.
Comments
Comment #1
thirdender CreditAttribution: thirdender commentedIf this happens, the easiest way to fix it is to remove the following lines from your theme's
.info
file:Then run
drush omega-revert
to reset the theme settings in the database to reflect the settings from the.info
file.There's probably also a way to set this to an empty array instead, but removing the lines seems to work just as well.