Skip to content

Environment

An environment is used by a ContentType, all revisions will be indexed into the alias. The environment attach to a contentType is the default environment for this contentType.

From the default environment we can publish/unpublish to other environments. Often an elasticms has 2 environments preview and live.

Properties

PropertyDescription
nameInternal name
labelDisplay label
colorDisplay color
aliasElasticsearch alias (EMSCO_INSTANCE_ID + name)
circles
inDefaultSearch
managed
snapshot
updateReferrers
templatePublicationTwig template, see Template publication
publishRolePublish Role, see Publish Role
baseUrlText field for defining an baseUrl

Publish Role

Block environment publication by user role, on revision detail page and compare environments page.

This overwrites the publish role on the contentType.

This does not apply for the default environment, publication in the default environment is managed by the contentType edit role.

Template publication

You can block publication to an environment by defining a publication template.

  • If the template adds a warning or error, the publication is block.
  • If the template add an info message, the publication is not block.
twig
{% set markdownMessage %}
**Validation failed**
* Document {{ revision.label }} is not validated (checkbox)
{% endset %}

{% if revision.contentType == 'page' and false == document.source.validated|default(false) %}
    {% do publication.addWarning(markdownMessage) %}
{% endif %}

Template context

  • publication : publication object (methods addWarning, addError, addInfo)
  • environment : current environment
  • revision : revision to be published
  • document : elasticsearch document of the revision (default environment)