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

[3.x]: Bug: New matrix blocks are added to all sites, eventhough 'Only save blocks to sites they were created in' is set #11366

Closed
bencresty opened this issue Jun 1, 2022 · 8 comments

Comments

@bencresty
Copy link

bencresty commented Jun 1, 2022

What happened?

Description

Using a website that's up for quite some time now without change to this matrix block, 'suddenly' (meaning after keeping Craft up to date) when creating a new entry and adding matrix blocks to a matrix field, these blocks also get added to other sites on the multisite/multilocale setup.
Eventhough 'Only save blocks to sites they were created in' is set in the matrix field.

This wasn't an issue before; before these blocks only got added to the current site/locale.

Steps to reproduce

  1. Create a new entry (content) which holds a Matrix Field on a multisite/-locale setup, where Matrix field is set to 'Only save blocks to sites they were created in'
  2. Add a new block to the matrix field
  3. Go to another locale/site on that setup
  4. Be surprised that the matrix block also appears there, eventhough it shouldn't be there

Expected behavior

As before: when 'Only save blocks to sites they were created in' is set matrix blocks shouldn't be added to other sites/locales.

Actual behavior

See above

Craft CMS version

3.7.43

PHP version

8.0.12

Operating system and version

Windows 10

Database type and version

MariaDb

Image driver and version

Installed plugins and versions

@bencresty
Copy link
Author

[Edit] It seems like this copying to other locales only happens when creating a new entry and saving it for the first time. Blocks added after the first save don't seem to get copied over to the other locale(s)/site(s).

@brandonkelly
Copy link
Member

This is the intended behavior, and has always been the case. The blocks are getting duplicated to the other sites though; they’re still single-site blocks. As soon as you switch to a different locale, or leave the entry and come back to it, etc., the normal behavior will take over.

@bencresty
Copy link
Author

bencresty commented Jun 3, 2022

This is the intended behavior

Thanks for your response. After writing my edit response I was afraid of that. Nice to see it's not a changed thing. To me I don't get this decision tho as it's confusing that the workings are different when saving for the first time compared to saving on a later time. It's also basically not what the setting of the block field says it will do. These type of decisions aren't only confusing and so could be prone to errors, but how can we explain this to clients?! Why not always treat it the same and make it logical and do what it's saying it will do?

Will this be different in Craft 4?

@brandonkelly
Copy link
Member

It did not change in Craft 4. You’re welcome to open a discussion about it, and we can certainly reconsider it for a future release, though.

FWIW, some version of this behavior should almost certainly not change. For example, when you create a new entry, I’m fairly confident the Title field should be duplicated across all sites as a starting point. So it’s more of a question of where we draw the line.

@jornwildenbeest
Copy link

jornwildenbeest commented Feb 2, 2023

Hi @brandonkelly, is is possible this behavior changed in Craft 4.3.6.1?

Our client always used this feature to easily translate content but after the update it does not work anymore.

@brandonkelly
Copy link
Member

@jornwildenbeest Doh, just tested and apparently this did change in 4.0—unintentionally. Just fixed that for the next release.

@jornwildenbeest
Copy link

@brandonkelly That would be great, thanks a lot!

@brandonkelly
Copy link
Member

Craft 4.3.7 has been released with that fix.

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

No branches or pull requests

3 participants