Skip to content

Commit

Permalink
[BUGFIX] Skip checkboxes that have a migrated label key
Browse files Browse the repository at this point in the history
Resolves: #4238
  • Loading branch information
simonschaufi committed Apr 18, 2024
1 parent 5cd28df commit 1af5fc7
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rules/TYPO311/v5/SimplifyCheckboxItemsTCARector.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ protected function refactorColumn(Expr $columnName, Expr $columnTca): void
return;
}

$labelKeyArrayItem = $this->extractArrayItemByKey($firstItemsArray, 'label');
if ($labelKeyArrayItem instanceof ArrayItem) {
// Skip migrated items which have a "label" key that comes from MigrateItemsIndexedKeysToAssociativeRector.
return;
}

// Remove the whole items array
$this->removeArrayItemFromArrayByKey($configArray, 'items');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Ssch\TYPO3Rector\Tests\Rector\v11\v5\SimplifyCheckboxItemsTCARector\Fixture;

return [
'ctrl' => [],
'columns' => [
'show_canonical' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'show_canonical',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'invertStateDisplay' => '1',
'items' => [
['label' => ''],
],
],
],
'no_archive' => [
'exclude' => 1,
'l10n_mode' => 'exclude',
'label' => 'no_archive',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
['label' => ''],
],
],
],
],
];

0 comments on commit 1af5fc7

Please sign in to comment.