Duplicating an item using Duplicate Item command a new item is created. This new item contains the same number of versions and language variants as the original item. This is not optimal from the performance perspective. When number of records in the master database grows, the system requirements grow as well, and more records mean slower queries.
The next side effect is that DisplayName is also duplicated. And when an author sees two items with the same display name in the content tree he could get confused or make an error. He could easily mistake the original with the duplicate item.
Duplicate Item Advanced
That is why we’ve created our own duplication, which offers possibility to duplicate just the scope that author wants. He can choose from three different commands:
- Duplicate All Language Versions
- Duplicate Current Language Version
- Duplicate Last Language Version
All three commands use the same processor they just set different type of operation in the pipeline arguments. The processor then executes the appropriate action base on the operation type set.
The method Execute reads pipeline arguments for information about the item being duplicated and type of duplication. It is stored in the class member field LatestVersionType.
The method DuplicateItem cleans up the duplicated versions based on the member field LatestVersionType.
The methods „RemoveDisplayNameInAllLangs“ a „ClearDisplayNameField“ then clear duplicated DisplayName.
The commands must be add to sitecore configuration as well as the processor providing advanced duplication.
The last step is to create new items in the context menu. Three items were created under the item /sitecore/content/Applications/Content Editor/Context Menues/Default and do not forget to set the correct command name in the Message field.