diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 70edd0496911..08d2de5f7377 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -75,11 +75,6 @@ parameters: count: 1 path: ../../typo3/sysext/backend/Classes/Controller/File/ThumbnailController.php - - - message: "#^Call to function is_array\\(\\) with string\\|null will always evaluate to false\\.$#" - count: 1 - path: ../../typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php - - message: "#^Parameter \\#1 \\.\\.\\.\\$expressions of method TYPO3\\\\CMS\\\\Core\\\\Database\\\\Query\\\\Expression\\\\ExpressionBuilder\\:\\:orX\\(\\) expects string, TYPO3\\\\CMS\\\\Core\\\\Database\\\\Query\\\\Expression\\\\CompositeExpression given\\.$#" count: 1 diff --git a/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php b/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php index 30bcb6e918d5..41d9a4712bd9 100644 --- a/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php +++ b/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php @@ -355,7 +355,7 @@ public function synchronizeLocalizeAction(ServerRequestInterface $request): Resp // Get the name of the field used as foreign selector (if any): $foreignSelector = isset($parentConfig['foreign_selector']) && $parentConfig['foreign_selector'] ? $parentConfig['foreign_selector'] : false; - $selectedValue = $foreignSelector ? GeneralUtility::quoteJSvalue($childData['databaseRow'][$foreignSelector]) : null; + $selectedValue = $foreignSelector ? $childData['databaseRow'][$foreignSelector] : null; if (is_array($selectedValue)) { $selectedValue = $selectedValue[0]; } diff --git a/typo3/sysext/core/Tests/Acceptance/Application/FormEngine/InlineContentElementLocalizeSynchronizeCest.php b/typo3/sysext/core/Tests/Acceptance/Application/FormEngine/InlineContentElementLocalizeSynchronizeCest.php new file mode 100644 index 000000000000..95ac666f67d1 --- /dev/null +++ b/typo3/sysext/core/Tests/Acceptance/Application/FormEngine/InlineContentElementLocalizeSynchronizeCest.php @@ -0,0 +1,119 @@ +useExistingSession('admin'); + + $I->click('Page'); + $I->waitForElement('svg .nodes .node'); + $pageTree->openPath(['styleguide TCA demo', 'staticdata']); + $I->switchToContentFrame(); + $I->waitForText('staticdata', 20); + } + + public function addingResourceToDefaultLangPageAddResourceToLocalizedPage(ApplicationTester $I): void + { + // Add a content element type images and localize it + $I->click('.module-body td[data-language-uid="0"] span[data-identifier="actions-add"]'); + $I->switchToWindow(); + $I->waitForText('Images Only'); + $I->click('Images Only'); + $I->switchToContentFrame(); + $I->waitForText('Create new Page Content on page "staticdata"', 3, 'h1'); + $I->click('Images'); + // Inline add record in Resources tab + $I->click('Images'); + $I->click('span[data-identifier="actions-insert-record"]', 'div.active'); + $I->switchToWindow(); + $I->switchToIFrame('modal_frame'); + // Find page 'styleguide' in page tree of modal and click it + $context = $I->executeInSelenium(function (RemoteWebDriver $webdriver) { + $context = $webdriver->findElement(WebDriverBy::cssSelector('div.element-browser-main-sidebar')); + return $context->findElement(WebDriverBy::xpath('//*[text()=\'styleguide\']/..')); + }); + // Add an image, closes modal again + $context->findElement(WebDriverBy::cssSelector('text.node-name'))->click(); + $I->waitForElementVisible('#typo3-filelist a[data-file-name="telephone_box.jpg"]'); + $I->click('#typo3-filelist a[data-file-name="telephone_box.jpg"]'); + // Save, go back to page + $I->switchToWindow(); + $I->switchToContentFrame(); + $I->click('.module-docheader a[title="Close"]'); + $I->switchToWindow(); + $I->waitForText('Save and close'); + $I->click('Save and close'); + // Switch to "All languages" view and localize content element + $I->switchToContentFrame(); + $I->waitForElementVisible('select[name=actionMenu]'); + $I->selectOption('select[name=actionMenu]', 'Languages'); + $I->waitForElementVisible('select[name=languageMenu]'); + $I->selectOption('select[name=languageMenu]', 'All languages'); + $I->waitForText('Translate'); + $I->click('Translate'); + $I->switchToWindow(); + $I->waitForText('Localize page "staticdata - language 1" into styleguide demo language danish'); + $I->click('span[data-identifier="actions-localize"]'); + $I->click('Next'); + $I->waitForText('Normal'); + $I->click('Next'); + $I->switchToContentFrame(); + $I->waitForText('(copy 1)'); + // Edit default language content element again and add another image + $I->click('.module-body td[data-language-uid="0"] span[data-identifier="actions-open"]'); + $I->waitForText('Edit Page Content on page "staticdata"', 3, 'h1'); + $I->click('Images'); + $I->click('span[data-identifier="actions-insert-record"]', 'div.active'); + $I->switchToWindow(); + $I->switchToIFrame('modal_frame'); + // Find page 'styleguide' in page tree of modal and click it + $context = $I->executeInSelenium(function (RemoteWebDriver $webdriver) { + $context = $webdriver->findElement(WebDriverBy::cssSelector('div.element-browser-main-sidebar')); + return $context->findElement(WebDriverBy::xpath('//*[text()=\'styleguide\']/..')); + }); + // Add an image, closes modal again + $context->findElement(WebDriverBy::cssSelector('text.node-name'))->click(); + $I->waitForElementVisible('#typo3-filelist a[data-file-name="underground.jpg"]'); + $I->click('#typo3-filelist a[data-file-name="underground.jpg"]'); + // Save, go back to page + $I->switchToWindow(); + $I->switchToContentFrame(); + $I->click('.module-docheader a[title="Close"]'); + $I->switchToWindow(); + $I->waitForText('Save and close'); + $I->click('Save and close'); + // Open the localized element and see that the second image can be synchronized + $I->switchToContentFrame(); + $I->waitForText('(copy 1)'); + $I->click('.module-body td[data-language-uid="1"] span[data-identifier="actions-open"]'); + $I->waitForText('Edit Page Content " (copy 1)" on page "staticdata"', 3, 'h1'); + $I->click('Images'); + $I->waitForText('underground.jpg'); + $I->click('span[data-identifier="actions-document-localize"]'); + // Synchronized image has been opened + $I->waitForText('Image Metadata'); + } +} diff --git a/typo3/sysext/core/Tests/Acceptance/Application/FormEngine/InlinePagesLocalizeResourceCest.php b/typo3/sysext/core/Tests/Acceptance/Application/FormEngine/InlinePagesLocalizeResourceCest.php new file mode 100644 index 000000000000..511b5413f8e1 --- /dev/null +++ b/typo3/sysext/core/Tests/Acceptance/Application/FormEngine/InlinePagesLocalizeResourceCest.php @@ -0,0 +1,72 @@ +useExistingSession('admin'); + + $I->click('List'); + $I->waitForElement('svg .nodes .node'); + $pageTree->openPath(['styleguide TCA demo', 'staticdata']); + $I->switchToContentFrame(); + $I->waitForText('staticdata', 20); + } + + public function addingResourceToDefaultLangPageAddResourceToLocalizedPage(ApplicationTester $I): void + { + // Add an image to media field of default lang page + $I->click('.module-docheader a[title="Edit page properties"]'); + $I->waitForText('Edit Page "staticdata"', 3, 'h1'); + // Inline add record in Resources tab + $I->click('Resources'); + $I->click('span[data-identifier="actions-insert-record"]', 'div.active'); + $I->switchToWindow(); + $I->switchToIFrame('modal_frame'); + // Find page 'styleguide' in page tree of modal and click it + $context = $I->executeInSelenium(function (RemoteWebDriver $webdriver) { + $context = $webdriver->findElement(WebDriverBy::cssSelector('div.element-browser-main-sidebar')); + return $context->findElement(WebDriverBy::xpath('//*[text()=\'styleguide\']/..')); + }); + // Add an image, closes modal again + $context->findElement(WebDriverBy::cssSelector('text.node-name'))->click(); + $I->waitForElementVisible('#typo3-filelist a[data-file-name="telephone_box.jpg"]'); + $I->click('#typo3-filelist a[data-file-name="telephone_box.jpg"]'); + // Save, go back to list + $I->switchToWindow(); + $I->switchToContentFrame(); + $I->click('.module-docheader a[title="Close"]'); + $I->switchToWindow(); + $I->waitForText('Save and close'); + $I->click('Save and close'); + // Edit the page translation and see if that resource has been added. + $I->switchToContentFrame(); + $I->waitForText('staticdata - language 1'); + $I->click('staticdata - language 1'); + $I->waitForText('Edit Page "staticdata - language 1"', 3, 'h1'); + $I->click('Resources'); + $I->see('telephone_box.jpg'); + } +}