File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -994,6 +994,11 @@ private function copyAction(string $type, string $entrySelector): array
994994 $ view = Craft::$ app ->getView ();
995995 $ id = sprintf ('action-copy-%s ' , mt_rand ());
996996
997+ $ baseInfo = Json::encode ([
998+ 'type ' => Entry::class,
999+ 'fieldId ' => $ this ->id ,
1000+ ]);
1001+
9971002 $ view ->registerJsWithVars (fn ($ id , $ fieldId , $ entrySelector ) => <<<JS
9981003(() => {
9991004 const btn = $('#' + $ id);
@@ -1010,7 +1015,17 @@ private function copyAction(string $type, string $entrySelector): array
10101015 const getEntries = () => field.find( $ entrySelector);
10111016
10121017 btn.on('activate', () => {
1013- Craft.cp.copyElements(getEntries());
1018+ Craft.cp.copyElements(getEntries().toArray().map((element) => {
1019+ element = $(element);
1020+ return {
1021+ ... $ baseInfo,
1022+ id: element.data('id'),
1023+ draftId: element.data('draftId'),
1024+ revisionId: element.data('revisionId'),
1025+ ownerId: element.data('ownerId'),
1026+ siteId: element.data('siteId'),
1027+ };
1028+ }));
10141029 });
10151030
10161031 setTimeout(() => {
You can’t perform that action at this time.
0 commit comments