Propagation on section level instead of field level #18192
-
|
Right now propagation happens on the field level for languages. It would be great if this could be set at the section level, like is possible now for the title and slug. I have a multi site setup for different languages and two sites share the same section in those languages, and I want each entry to be the same per language. If I use propagation on the field level for each language, it also changes field values in other sections that reuse these fields, but I want it to ONLY propagate in sites that have the same section. So the section level propagation settings would then override the individual field settings. This way I can have two sections that exactly the same and not a duplication, across websites. They exact same content needs to be in two websites, one for the purpose of editing and the other one for SEO. Is this structurally doable in a new version of Craft maybe? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
You could set your fields’ propagation methods to “Custom”, and then set the propagation format to something like: {{ object is instance of('craft\\elements\\Entry') and (object.section.handle ?? null) in ['sectionA', 'sectionB'] ? '*' : object.site.language }}That will check if an entry is being saved, and if it's in either If so, it will output Otherwise, it will output the site’s language, causing the field to be translatable for each language. (Modify depending on what you want the fallback propagation strategy to be.) |
Beta Was this translation helpful? Give feedback.
-
|
That's a great way to do it! Thanks for the suggestions. I will propagate the fields as follows, depending on the type of field. Text Fields (Body Content, Titles, Rich Text, etc.)
Switches/Toggles (Feature flags, visibility toggles, etc.)
|
Beta Was this translation helpful? Give feedback.
-
|
To make it work if the field is in a matrix field: and
|
Beta Was this translation helpful? Give feedback.
You could set your fields’ propagation methods to “Custom”, and then set the propagation format to something like:
{{ object is instance of('craft\\elements\\Entry') and (object.section.handle ?? null) in ['sectionA', 'sectionB'] ? '*' : object.site.language }}That will check if an entry is being saved, and if it's in either
sectionAorsectionB(replace those with the section handles you want to always propagate).If so, it will output
*for all sites, so all sites will share the same content.Otherwise, it will output the site’s language, causing the field to be translatable for each language. (Modify depending on what you want the fallback propagation strategy to be.)