cms icon indicating copy to clipboard operation
cms copied to clipboard

Copy field values from other sites

Open brianjhanson opened this issue 1 year ago • 3 comments

Continuation of #12436 but instead of handling the copy server-side, the controller will return fragments of HTML that we use to replace fields and immediately save a draft. This simplifies the logic a bit as we can rely on existing "Save Draft" processes to save the values.

Description

On the entry/category edit page (elements that support autosaving drafts):

  • Added an item to the action menu that allows you to copy all, translatable, changed values from another site
  • translatable field icon now triggers a HUD, which contains a form that allows you to copy just that field’s value from the selected site; copy action is applied to the top-level fields (e.g. entire matrix field)
  • plugins need to implement CopyableFieldInterface to use this feature

IMPORTANT: once this feature is released, an update to craftcms/html-field needs to be released; https://github.com/craftcms/html-field/pull/6

https://github.com/craftcms/cms/assets/1843073/e7278397-aa1b-4fdb-bc9a-0694b8a865e0

brianjhanson avatar Dec 18 '23 23:12 brianjhanson

I think this was "missing piece" of multi-language functionality of Craft CMS. Thanks for adding this.

piotrpog avatar Dec 26 '23 15:12 piotrpog

I think this was "missing piece" of multi-language functionality

I concur; really looking forward to seeing it merged. Any chance it'll make it into 5.2? 😇

mmikkel avatar May 10 '24 12:05 mmikkel