Skip to content

[BUGFIX] Pass colPos when moving copyToLanguage children - #783

Merged
achimfritz merged 1 commit into
masterfrom
bugfix/copy-to-language
Nov 4, 2026
Merged

achimfritz merged 1 commit into
masterfrom
bugfix/copy-to-language

Conversation

@achimfritz

Copy link
Copy Markdown
Contributor

After copyToLanguage of a container, the copied container and its children are moved into place by separate move commands. These commands used "action: paste" without "update.colPos".

Content restriction hooks (EXT:content_defender and the ContentElementRestriction hook of EXT:container) only use the paste target if "update.colPos" is set. Otherwise they cast the whole command value to int, which results in 1, and resolve the backend layout of page uid 1. If this page does not exist, an exception is thrown and copyToLanguage fails.

The move commands now pass the colPos of the container and of each child. The target record is used to resolve page and column, and the regular container restrictions apply to the translated children.

Tests:

  • Add a content_defender test for copyToLanguage on an installation without page uid 1
  • Run localizeWithMultipleNestedElements with content_defender as well, with nested containers placed in a column that allows them
  • Move the nested containers in the localizeWithMultipleNestedElements fixtures from colPos 200 to 201, because colPos 200 does not allow them and the restrictions now apply

After copyToLanguage of a container, the copied container and its
children are moved into place by separate move commands. These
commands used "action: paste" without "update.colPos".

Content restriction hooks (EXT:content_defender and the
ContentElementRestriction hook of EXT:container) only use the paste
target if "update.colPos" is set. Otherwise they cast the whole
command value to int, which results in 1, and resolve the backend
layout of page uid 1. If this page does not exist, an exception is
thrown and copyToLanguage fails.

The move commands now pass the colPos of the container and of each
child. The target record is used to resolve page and column, and
the regular container restrictions apply to the translated
children.

Tests:

- Add a content_defender test for copyToLanguage on an
 installation without page uid 1
- Run localizeWithMultipleNestedElements with content_defender as
 well, with nested containers placed in a column that allows them
- Move the nested containers in the localizeWithMultipleNestedElements
 fixtures from colPos 200 to 201, because colPos 200 does not
 allow them and the restrictions now apply
@achimfritz
achimfritz requested a review from ervaude November 3, 2026 14:02
@achimfritz
achimfritz merged commit 6088370 into master Nov 4, 2026
17 checks passed
@achimfritz
achimfritz deleted the bugfix/copy-to-language branch November 4, 2026 11:27
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 this pull request may close these issues.

2 participants