We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

3.2.0 DP2 - Toggle Field in Grid: Undefined index: field_settings

Developer Preview

TJ Draper's avatar
TJ Draper
222 posts
9 years ago
TJ Draper's avatar TJ Draper

When creating a toggle field in a grid field, submission fails with the error message:

Undefined index: field_settings

ee/EllisLab/Addons/toggle/ft.toggle.php, line 229

After that things get pretty wacky. Channel entries with this grid field can no longer be saved to do an exception:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'col_id_5' in 'field list':
UPDATE `exp_channel_grid_field_13` SET `col_id_4` = CASE WHEN `row_id` = '1' THEN 'https://tjdraper.com' ELSE `col_id_4` END, `col_id_5` = CASE WHEN `row_id` = '1' THEN 1 ELSE `col_id_5` END, `row_order` = CASE WHEN `row_id` = '1' THEN 0 ELSE `row_order` END WHERE `row_id` IN ('1')

/home/vagrant/ee300edge/system/ee/legacy/database/drivers/mysqli/mysqli_connection.php:119

But the field still shows up in that grid field.

Removing the the toggle field from grid produces an error, though the field then appears to be removed.

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
9 years ago
Kevin Cupp's avatar Kevin Cupp

Thanks, TJ, sorry about that. I’ve added the new Toggle field to our Grid settings tests to make sure it doesn’t come up again. Changing ft.toggle.php’s get_column_type() to this should fix it:

protected function get_column_type($data, $grid = FALSE)
 {
  $id = ($grid) ? 'col_id' : 'field_id';
  $default_value = ($grid) ? $data['field_default_value'] : $data['field_settings']['field_default_value'];

  return array(
   $id.'_'.$data[$id] => array(
    'type'  => 'TINYINT',
    'null'      => FALSE,
    'default'   => $default_value
   )
  );
 }
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.