Develop Secure Code
getContent
getContext
updateContent
getContextRetrieves metadata about the content item in the content editor in an enhanced CMS workspace.
1import { LightningElement, wire } from 'lwc';
2import { getContext } from experience/cmsEditorApi;
3
4export default class Example extends LightningElement {
5 @wire(getContext, {})
6 context;
7}data
variantId—ID of the content variant.contentSpaceId—ID of the workspace that contains the content item.managedContentId—ID of the CMS content item.contentKey—Unique identifier that tracks a content item through version updates and across environments. Assigned automatically when content is added to a CMS workspace.schema—Information layout based on the content type.error—A validation error for invalid fields.