Coder Social home page Coder Social logo

sitecore-smart-commands's Introduction

Sitecore Smart Commands

Sitecore Smart Commands is a shared-source module that contains smart copy, duplicate and clone commands in Content Editor.

Download

You can find downloads in github releases tab.

Known issues

Most of the features (1, 2, 3) do not support Item Buckets out of the box and may break this functionality so please dot not install this module if you use Item Buckets or going to use them. However you can still use this module API and code to implement you own needs.

Why is this solution better?

Comparing to any other solutions, this one uses stock Sitecore link replacement functionality instead of custom logic. Have you ever seen the Breaking links dialog which offers:

  • delete links
  • keep links broken
  • change links to point to another item

So this module uses same API as the Breaking links dialog.

Features

1. Smart Duplicate

The Smart Duplicate button that does the same thing as normal Duplicate Item, but in addition to that it replaces links from source item (and its descendants) to newly created item (and its descendants). Note, it does not work with item buckets.

Having this item tree

  sourceItem: linkField -> sourceChild 
    sourceChild: linkField -> sourceItem

by default, when duplicating it the result becomes

  copyItem: linkField -> sourceChild
    copyChild: linkField -> sourceItem

But with Smart Duplicate it becomes

  copyItem: linkField -> copyChild
    copyChild: linkField -> copyItem

2. Smart Copy To

Same as Smart Duplicate, but new item appears in another folder.

3. Smart Clone

Same as Smart Copy To, but instead of plain copying the Item Clone is created.

4. Smart Create From Branch

Same idea as with feature number 2, but this time links are expanded for items created from branch templates.

Important: unlike items 1-3 you cannot use original link-agnostic Create From Branch command - create from branch operations will be smart.

Having this branch template

  my branch
    $name: linkField -> branchChild
      branchChild: linkField -> $name

by default, the item created from this branch template becomes

  createdItem: linkField -> branchChild
    createdChild: linkField -> $name

With smart link replacement it becomes expected:

  createdItem: linkField -> createdChild
    createdChild -> createdItem

sitecore-smart-commands's People

Contributors

alenpelin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sitecore-smart-commands's Issues

Test failure

When I fixed my previously created issues, the latest version did not work.
Rework of ReferenceReplacementJob, 91d15df.
Unit test fails aswell (ID stays the same).

Sitecore 9.2+ support

Right, so I think I've sorted out what's going on here:

  • Sitecore 9.2 has refactored the Job API a bit so current implementation wouldn't work but could be easily fixed
  • At some point the built-in ReferenceReplacementJob seems to be changed to support clones only - so this job no longer works for "smart copy" or "smart duplicate", it would only work for "smart clone"
  • I have fixed that by copying the ReferenceReplacementJob code and modifying it slightly to not do hardcoded checks for item.SourceUri which is only available on clones.
  • The PR #6 seems to address fixing the Job API refactor, and also adds in some code to support updating layout fields on branch template copies. However I tested this on Sitecore 10.0 and it (updating layout fields on branch template copies) isn't required as the ReferenceReplacementJob does this too.

I would open a PR, however I'm only interested in the Smart Copy and Smart Duplicate , and so won't have tested Clone, and also am unsure as to why this ReferenceReplacementJob used to work and doesn't now so would be good to figure out exactly which version this was changed.

Nuget packages

Seems to be using non-publicly available Nuget packages?
I replaced them with the Sitecore.*.NoReferences alternatives to get a local build.
I did this for version 8.2.161115.

Serialized items issues

When trying to update my core database I ran into the following issues:

  1. many items have a missing parent ("Menu"-folder)
  2. commands are defined as essentials:XXX instead of smartcommands:XXX (config)

Item buckets issue?

What is exactly the issue with using this module with item buckets? We are very interested in this module but are using item buckets as well. Maybe something can be fixed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.