Optimizely CMS Common Interfaces
In this blog post we are going to explain a little bit which ones are some of the common interfaces used in the Optimizely/Episerver CMS and how these interfaces can be used. So without further due lets begin.
IContentLoader
This interface allows the developer to access any content in the CMS. It is recommended to use when you want to get read only content items. It uses the cache layer implemented by the CMS improving performance when requesting items.
Method | Description |
---|---|
Get<T> | Gets a T content item using a GUID or a Content Reference |
GetAncestors | Gets all items as IContent on top of the current Content Reference item |
GetBySegment | Gets an item as IContent using a parent Content Reference, the path to access it and the language |
GetChildren<T> | Gets all T content items that are below (1 level) from the current Content Reference item |
GetDescendents | Gets all items as IContent below of the current Content Reference item |
GetItems | Gets all items as IContent from a list of Content Reference items and a language |
IContentRepository
This interface allows the developer to not just access to any content in the CMS, but also take some actions around the item like save, move, generate copies, send them to trash and more. Behind the scenes IContentRepository inherits the interface IContentLoader.
Method | Description |
---|---|
Copy | Copies a content item choosing a destination, it requires proper permissions to execute it |
CreateLanguageBranch<T> | Create a language branch for the current Content Reference item T using a culture info |
DeleteLanguageBranch<T> | Deletes a language branch for the current Content Reference item T using a culture info |
GetLanguageBranches<T> | Get all T content items for the current Content Reference item T for each language |
Delete | Delete a Content Reference item, it can force the deletion if necessary |
DeleteChildren | Deletes all content items that are below (1 level) from the current Content Reference item |
Save | Save or publish a content item if the proper permissions are passed |
Move | Moves a Content Reference item below the Content Reference item selected as destination, it requires proper permissions |
MoveToWastebasket | Allows to move a Content Reference item to the waste basket specifying the user |
GetReferencesToContent | It gets all the references of a Content Reference item and its descendants if required |
ListDelayedPublish | Get all IContent items which have been set to delay publish |
GetDefault<T> | Gets a new instance of a T content item so it can be added as part of the CMS |
ILanguageBranchRepository
Used to get all the relevant information about languages in the CMS including which ones are active and it also allows to modify the language branches available in the site.
Method | Description |
---|---|
ListAll | Gets all language branches available in the CMS including the ones which are not active |
ListEnabled | Gets all languages branches which are available and active in the CMS |
LoadFirstEnabledBranch | Gets the first active branch in the CMS in the order defined in the languages interface |
Delete | Deletes a language branch based on the id |
Save | Saves the modifications of a language branch passed as parameter |
Load | It loads a language branch chosen by the culture info send as parameter |
ISiteDefinitionRepository
This interface is used to get and modify the sites which are active in the CMS.
Method | Description |
---|---|
List | List of all site definitions available in the site |
Delete | Deletes a site based on its GUID |
Save | Saves the modifications of a site definition passed as parameter |
Get | It loads a site definition chosen by its GUID send as parameter |
These are some of the most common used interfaces for developers trying to implement solutions in the Optimizely/Episerver CMS. If you have any question let me know. I hope it will help someone and as always keep learning !!!
2 COMMENTS