Create a new revision from twig
{% set contentType = 'page'|get_content_type %}
{% set newRevision = emsco_revision_create(contentType, ems_uuid(), {
'title': 'Test',
'locale': 'de'
}) %}
Will overwrite the rawData, you can also use emsco_revision_merge.
Use case example: update an other document on post processing.
It will return the new revision, if you do not needed you can just use twig do
{% do emsco_revision_update("ems://object:page:1", {
title: 'Update test',
body: '<h1>TEST<\/h1>'
}) %}
Will merge the passed rawData into the current rawData.
It will return the new revision, if you do not needed you can just use twig do
{% do emsco_revision_merge("ems://object:page:1", {
body: '<h1>Merge<\/h1>'
}) %}
Returns a iteratable result of revisions for the given contentTypeName
{% set ouuidsPagesInDraft = emsco_revisions_draft('page')|map(r => r.ouuid) %}
The emsco_document_info
filter on a EMSLink object or on a EMSId string (i.e. contentTypeName:ouuid
) returns a DocumentInfo
object with the following method:
- revision(string environmentName): returning null of a Revision. False otherwise.
- draft/hasDraft: returning true if there is a draft in progress. False otherwise.
- aligned(string environmentName): returning true if the revision linked to the environment is the current one. False otherwise.
- published(string environmentName): returning true if a revision is published in that environment. False otherwise.