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.
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
)
);
}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.