Skip to content

Commit

Permalink
fix(SFT-1672): table layout migration check for undefined array keys
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavs-gutmanis committed Dec 19, 2024
1 parent a47570b commit cff5306
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,24 @@ public function safeUp(): bool
continue;
}

if ('select' === $row['type']) {
$tableLayout[$index]['options'] = explode(';', $row['value']);
$type = $row['type'] ?? '';
$value = $row['value'] ?? '';

if ('select' === $type) {
$tableLayout[$index]['options'] = explode(';', $value);
$tableLayout[$index]['value'] = $tableLayout[$index]['options'][0] ?? '';
} else {
$tableLayout[$index]['options'] = [];
}

if ('checkbox' === $row['type']) {
$tableLayout[$index]['value'] = (bool) $row['value'];
if ('checkbox' === $type) {
$tableLayout[$index]['value'] = (bool) $value;
}

$tableLayout[$index]['placeholder'] = '';

if ('checkbox' === $row['type']) {
$tableLayout[$index]['checked'] = (bool) $row['value'];
if ('checkbox' === $type) {
$tableLayout[$index]['checked'] = (bool) $value;
} else {
$tableLayout[$index]['checked'] = false;
}
Expand Down

0 comments on commit cff5306

Please sign in to comment.