Skip to content

Commit

Permalink
[BUGFIX] Skip orphan rte options
Browse files Browse the repository at this point in the history
  • Loading branch information
nhovratov committed Dec 20, 2021
1 parent dcff7ff commit 837e8fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Classes/Loader/JsonLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ public function load(): TableDefinitionCollection
foreach ($element->options as $index => $option) {
if ($option === 'rte') {
trigger_error('Migration for options rte done in element "' . $element->key . '". Please update your json definition.', E_USER_DEPRECATED);
$fieldKey = $element->columns[$index];
$fieldKey = $element->columns[$index] ?? '';

// Sometimes these options are orphans and weren't removed..
if ($fieldKey === '') {
continue;
}

$field = $this->tableDefinitionCollection->loadField($tableDefinition->table, $fieldKey);
if ($field instanceof TcaFieldDefinition) {
$field->type = new FieldType(FieldType::RICHTEXT);
Expand Down
3 changes: 2 additions & 1 deletion Tests/UnitDeprecated/Fixtures/Configuration/legacyRte.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"0": "tx_mask_rte"
},
"options": {
"0": "rte"
"0": "rte",
"1": "rte"
}
}
},
Expand Down

0 comments on commit 837e8fc

Please sign in to comment.