Globalization, Mirroring, Dynamic Functions and Properties in EPiServer Composer 4 R2
This document discusses globalization in relation to specific EPiServer Composer functionality, and what to think about when working with language and version management in EPiServer Composer 4 R2.
Language Management in EPiServer Composer
Basically, Composer pages are just an extension of EPiServer standard pages, where the structure of the pages (the layout and the functions) are stored in a special property named “Composer Page Property”, which by default has the flag “unique per language” enabled. This ensures that each language can have a unique structure with its own functions and layout, where you can switch back and forth between versions exactly the same way as for standard CMS pages.
How do I work with language versions in Composer?
In Edit mode, Composer language versions work exactly the same way as for standard CMS pages. A new language version has no content and the first created language will be the master language for that page.
In the Toolbox of the Composer Edit-on-page mode, you will find the tab “Versions” with a dropdown list where the available languages are listed. When switching to a language in which the page you are working with has not yet been created, you will have two options:
- Create a new empty page language version, where you can create content from scratch.
- Create a new page language version and copy all functions and layout from a selected language to the new created version.
We can also list the versions for a specific language or all languages and go directly to the Composer Edit mode by clicking on a page version in the list.
Why Global Functions are not Supported by Globalization
A global function is unique for the website and has only one instance. This means that a global function will not be supported by the globalization (language versions). This also means that a global function with English content can be placed and displayed in a Swedish page version, as an example.
Does the Composer support Mirroring and Import/Export with globalization?
Yes, this will work exactly the same way as for standard EPiServer CMS pages.
How can I create a Composer language version through code via the EPiServer Composer API?
Use the static method PageDataManager.CreateLanguageBranch().
Dynamic Functions
What is a dynamic function?
The dynamic function makes it possible to fetch any content function (including child functions) from any Composer page to a selected page (compare the “Fetch data from” function in EPiServer CMS). In the Composer 4 R2 sample template package, an example of a dynamic function is available as the "Content from Other Page" content block in the toolbox.
When to use a dynamic function?
When an editor wants to publish parts of the content from one page to another page within the website, or let other pages automatically fetch the first content function (in a structure/list) for a specific page.
How do I create a dynamic function?
In order to use the dynamic function you need to create a content function and add a property with type “Dynamic function property”. The property allows you to link to any content function from another Composer page (see the “Content from Other Page” in the Composer Sample package).
The dynamic function supports linking to any kind of Composer function, including content, layout, global function and dynamic function.
Limitations and known issues:
- Dynamic function does not support fetching content from a specific area in a layout function.
- The functions on a page will be displayed with the function type name and no preview possibility.
Composer Dynamic Property
What is a dynamic property?
A dynamic property allows for the display of a specific global function in a content area (first/last) and for Composer page types. The content will be applied to a subset of pages in the page tree by using the standard dynamic property. The content can be overridden exactly the same way as the built in functionality.
When to use a dynamic property?
The dynamic property can be used when there is a certain Composer content that you want to include in Composer pages created with a specific page type. You can have one or more Composer dynamic properties applied to a specific page type. NOTE Use Composer dynamic properties with restriction to avoid performance problems on your website.
How do I create a dynamic property?
- Create a new global content.
- Define a new dynamic property in CMS Admin mode with type: “Composer Dynamic Content Property”.
- Go to Edit mode and select the root page where you want to apply the dynamic property.
- Edit the Dynamic Properties.
- Set the page value for the Composer dynamic content property:
- Page type: The Composer page type that the property will be applied to.
- Content Area Id: The area that the content will be shown
- The position of the dynamic content; First or Last.
- The global function for the content.
Working with Composer Mirroring and Import/export Between Sites
Setup the mirroring
There are three channels that you need to set up in order to get the mirroring to work properly with Composer:
- Content Channel: The part of the tree for mirroring pages.
- Global function: For mirror the Global functions.
- Composer templates: For mirror the Composer templates.
Export and import Composer pages
You can use the standard Export and Import functionalities in EPiServer CMS for transferring the Composer pages.
Export and import Composer global functions and templates
Use the EPiServer Composer Import/Export under Tools (Admin tab in EPiServer CMS Admin mode) for exporting (and importing) the Global functions and the Composer templates.
Export the Composer function type definitions
To transfer a definition for a Composer function type including categories, properties and access rights, you have to use the Composer import/export functionality to create an XML file for the definition.
When importing, Composer will create both the page type representing the function type and all definitions (categories, properties and access rights).
NOTE EPiServer Composer 2 R2 will not support mirroring of unpublished pages. The mirroring job will throw an exception when mirroring unpublished EPiServer Composer pages.