Skip to content

Commit

Permalink
[BUGFIX] fix usages of allowTableOnStandardPages with mutliple tablen…
Browse files Browse the repository at this point in the history
…ames in one string (#4276)
  • Loading branch information
Kanti authored and simonschaufi committed May 25, 2024
1 parent 982a702 commit 12db6fa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,16 @@ public function refactor(Node $node)
return null;
}

$tableName = $this->valueResolver->getValue($tableArgument);

$directoryName = dirname($this->file->getFilePath());
$newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/' . $tableName . '.php';
$this->writeConfigurationToFile($newConfigurationFile, $tableName);

$tableNames = $this->valueResolver->getValue($tableArgument);

foreach (explode(',', $tableNames) as $tableName) {
if (!$tableName) {
continue;
}
$directoryName = dirname($this->file->getFilePath());
$newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/' . $tableName . '.php';
$this->writeConfigurationToFile($newConfigurationFile, $tableName);
}
return NodeTraverser::REMOVE_NODE;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$GLOBALS['TCA']['tx_table_one']['ctrl']['security']['ignorePageTypeRestriction'] = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$GLOBALS['TCA']['tx_table_two']['ctrl']['security']['ignorePageTypeRestriction'] = true;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

ExtensionManagementUtility::allowTableOnStandardPages('tx_table_with_existing_tca_configuration_file');
ExtensionManagementUtility::allowTableOnStandardPages('tx_table_without_existing_tca_configuration_file');
ExtensionManagementUtility::allowTableOnStandardPages('tx_table_one,tx_table_two');

?>
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ public function test(): void
__DIR__ . '/Fixture/Configuration/TCA/Overrides/%s.php',
'tx_table_with_existing_tca_configuration_file'
);
$this->assertThatConfigurationFileHasNewIgnorePageTypeRestriction(
__DIR__ . '/Fixture/Configuration/TCA/Overrides/%s.php',
'tx_table_one'
);
$this->assertThatConfigurationFileHasNewIgnorePageTypeRestriction(
__DIR__ . '/Fixture/Configuration/TCA/Overrides/%s.php',
'tx_table_two'
);
}

public function provideConfigFilePath(): string
Expand Down

0 comments on commit 12db6fa

Please sign in to comment.