Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in page layout using latest "master" branch #150

Closed
sypets opened this issue Feb 23, 2023 · 2 comments · Fixed by #155
Closed

Exception in page layout using latest "master" branch #150

sypets opened this issue Feb 23, 2023 · 2 comments · Fixed by #155

Comments

@sypets
Copy link
Contributor

sypets commented Feb 23, 2023

Using latest master with latest TYPO3 11.5 branch.

I initially reported this for the branch #148, but this can be reproduced with master.

Reproduce

Using latest installation base on TYPO3 core repo (without Composer) + EXT:styleguide.

Prepare:

  1. Created "clean" installation (uninstalled previous wv_deepltranslate, DB update, cache flush etc.)
  2. git cloned
  3. Activated via Extension Manager, double checked DB update and flushed cache

Reproduce

  1. Go to start page in page tree (with several lanagues)

Error message

#1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: Array to string conversion in /var/www/t3coredev11/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/AbstractNode.php line 73

Debugging: Breakpoint in AbstractNode.php line 73

array:

value
0 => 'Neue Übersetzung dieser Seite erstellen'
/typo3/record/commit?token=f5c48333dd5e0d1ab103e47ac67fabcb7369d7d8&redirect=%2Ftypo3%2Frecord%2Fedit%3Ftoken%3D9a2f0a1c119f048a0f994cf550489f24d9bfd4e0%26justLocalized%3Dpages%253A3%253A2%26returnUrl%3D%252Ftypo3%252Fmodule%252Fweb%252Flayout%253Ftoken%253D9199032a6eef2ccb404d82e3b4f719144fe5e18c%2526id%253D3%2526&cmd%5Bpages%5D%5B3%5D%5Blocalize%5D=2&cmd%5Blocalization%5D%5Bcustom%5D%5Bmode%5D=deepl 
=> 'Nederlands'

....

Possible cause of error

<select class="form-select" name="createNewLanguage" data-global-event="change" data-action-navigate="$value">
                    <deepl:deeplTranslate context="{context}"/>
                    <f:for each="{deepl:deeplTranslate(context: '{context}')}" as="languageName" key="url">
                        <option value="{url}">{languageName}</option>
                    </f:for>

Viewhelper is called twice. The way it is used should cause problems because it returns an array.

https://github.com/web-vision/wv_deepltranslate/blob/master/Classes/ViewHelpers/DeeplTranslateViewHelper.php

Exception dump

<select class="form-select" name="createNewLanguage" data-global-event="change" data-action-navigate="$value">

exception_wvdt.txt

@sypets
Copy link
Contributor Author

sypets commented Feb 23, 2023

Further investigation:

!!! The templates / partials for v10 are also parsed so this can result in problems in v11 !!!

When I make the following changes (just for investigating what's the problem), the exception is no longer displayed:

  1. remove the line <deepl:deeplTranslate context="{context}"/> in Resources/Private/Backend/Partials/v10/PageLayout/LanguageColumns.html

  2. remove the line <deepl:deeplTranslate context="{context}"/> in Resources/Private/Backend/Partials/PageLayout/LanguageColumns.html

Also, there is this: DeeplRecordsListController

. '<select class="form-select" name="createNewLanguage" data-global-event="change" data-action-navigate="$value">'
                            . $options
                        . '</select>'

When setting breakpoint in the ViewHelper, I can confirm it is called, creating the array mentioned above.

After the above changes, I can load the page but then get this exception when trying to create another language overlay for the page ("Create a new translation for the page"):

PHP Warning: Undefined array key "behaviour" in /var/www/t3coredev11/typo3conf/ext/wv_deepltranslate/Classes/Hooks/AllowLanguageSynchronizationHook.php line 24

@calien666
Copy link
Member

Shold be resolved with this: #143
I saw the problem, too, and changed implementation of correct Template in ext_typoscript_setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants