Cloning Pages

The clone pages feature allows users to clone primary and variation pages in content catalogs.

Clone Page Wizard Service

The Clone Page Wizard service (clonePageWizardService) manages clone page operations. It consists of two steps:

  1. Populating the required fields:

    • Target Catalog and Version
    • Display Condition
    • Primary page associated to the variation
    • Name and Label
  2. Performing a submit by clicking the Done button.

The following diagram shows what happens in the frontend and back end after a user specifies all the required fields and clicks the Done button in the wizard.

After the user enters the data in the required fields, the pageFacade sends a payload with the information about the new page to the CMSItemController. The CMSItemController uses the createItem() function from the CMSItemFacade to create an ItemModel based on the payload. After the page has been created, the clonePageWizardService updates the experience (experienceService) with a new page ID if the page was cloned in the same catalog version. If the page was cloned in another catalog version, an alert is displayed that the user can select to go to the new page in the other catalog version. Using populators, the CMSItemFacade uses the cloning strategy to clone the page. The clonePageWizardService provides a cloneComponents boolean value to the cloning strategy. Based on this value, the CloningStrategy clones components on the page when the cloneComponents=true or references existing components when cloneComponents=false.

Mandatory Fields of the Clone Page Wizard

The following fields are mandatory in the clone page wizard:

  • Target catalog and version
  • Display condition
  • Primary page associated to the variation page
  • Name and label

The following sections describe the logic for each field.

Target Catalog and Version Dropdown

The following image shows the logic behind the Target Catalog and Version Dropdown in a multicountry site environment:

The dropdown, represented by selectTargetCatalogVersionModule, displays a list of catalog versions that the current user has write access to. The CMSCatalogVersionService extracts the list of catalog versions.

There are two cases that use other functions. These cases are as follows:

  • If the source catalog version is a non-active version, the getWritableContentCatalogVersions() function is used: The target catalog version can be either the catalog version of the page being cloned or any non-active catalog version in the current catalog that the user has write access to.
  • If the source catalog version is an active version, the getWritableChildContentCatalogVersions() function is used: The target catalog version is the list of all non-active catalog versions of all its children that the user has write access to.

The logic described above applies to a multicountry site environment. In a non-multicountry site environment, only the getWritableContentCatalogVersions() function is used; this is the first case shown in the preceding image.

For more information on CatalogVersionFacade and CMSCatalogVersionService, see Catalog Version API.

Display Condition and Primary Page associated to the Variation Fields

The following image shows how the Display Condition and Primary page associated to the variation fields are populated:

The newPageDisplayConditionModule extracts the list of page conditions using the pageDisplayConditionsService, which in turn calls the CatalogVersionController. If the user is cloning a variation page, the pageService is used to extract the list of all primary pages for the current page type. To do so, it calls the PageController on the backend.

Name and Label

The following diagram shows the logic behind the information message. SmartEdit shows this message when a user clones a primary page from the parent catalog to the target catalog, if that page already exists in the target catalog:

The CMSItemFacade verifies if a content page with a specified label exists in the target catalog version. If the page exists, the CMSItemController returns a boolean value to the frontend.

The following image shows an example of such a message. This message is only displayed in a multicountry site environment.