Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 96 additions & 87 deletions source/includes/freemarker-variables.rst
Original file line number Diff line number Diff line change
@@ -1,100 +1,109 @@
+---------------------------+---------------------------------------+------------------------------------+
|| Name || Description || Type |
+===========================+=======================================+====================================+
|| siteItemService || Allows access to the site || |SiteItemService| |
|| || content. || |
+---------------------------+---------------------------------------+------------------------------------+
|| urlTransformationService || Service for transforming URLs, || |UrlTransformationService| |
|| || like transforming the content || |
|| || URL of a page to the web or || |
|| || render URL. || |
+---------------------------+---------------------------------------+------------------------------------+
|| applicationContext || Provides access to the Crafter || |ApplicationContextAccessor| |
|| || Engine's Spring beans and site || |
|| || beans defined in || |
|| || config/spring/application- || |
|| || context.xml. || |
+---------------------------+---------------------------------------+------------------------------------+
|| globalProperties || Provides access to global || `PropertySourcesPropertyResolver`_|
|| || configuration properties || |
|| || defined in || |
|| || server-config.properties. || |
+---------------------------+---------------------------------------+------------------------------------+
|| navBreadcrumbBuilder || Helper class that returns the || |BreadcrumbBuilder| |
|| || list of path components in an || |
|| || URL, to create navigation || |
|| || breadcrumbs. || |
+---------------------------+---------------------------------------+------------------------------------+
|| navTreeBuilder || Helper class that creates || |NavTreeBuilder| |
|| || navigation trees to || |
|| || facilitate rendering. || |
+---------------------------+---------------------------------------+------------------------------------+
|| tenantsResolver || Can be used to retrieve the || |TenantsResolver| |
|| || Profile tenants associated to || |
|| || the current site. || |
+---------------------------+---------------------------------------+------------------------------------+
|| modePreview || Flag that indicates that Engine is || Boolean |
|| || being executed in preview mode || |
|| || (also the value of the || |
|| || ``crafter.engine.preview`` property) || |
+---------------------------+---------------------------------------+------------------------------------+
|| crafterEnv || Indicates the value of the || String |
|| || ``crafter.engine.environment`` || |
|| || property || |
+---------------------------+---------------------------------------+------------------------------------+
|| siteConfig || The current site Configuration || |XMLConfiguration| |
|| || loaded from /config/site.xml. || |
+---------------------------+---------------------------------------+------------------------------------+
|| siteContext || The current SiteContext || |SiteContextHashModel| |
+---------------------------+---------------------------------------+------------------------------------+
|| request || The current request || |HttpRequestHashModel| |
+---------------------------+---------------------------------------+------------------------------------+
|| requestParameters || The parameter values for the || `HttpRequestParametersHashModel`_ |
|| || current request || |
+---------------------------+---------------------------------------+------------------------------------+
|| cookies || The cookie values for the || |Map| |
|| || current request || |
+---------------------------+---------------------------------------+------------------------------------+
|| session || The current session || `HttpSessionHashModel`_ |
+---------------------------+---------------------------------------+------------------------------------+
|| locale || The current locale for the || |Locale| |
|| || current user || |
+---------------------------+---------------------------------------+------------------------------------+
|| authToken || The current authentication (if || |SpringAuthentication| |
|| || the user has logged in), || |
|| || created by Spring Security || |
+---------------------------+---------------------------------------+------------------------------------+
.. list-table::
:align: left
:header-rows: 1
:widths: 25 45 30

* - Name
- Description
- Type
* - siteItemService
- Allows access to the site content.
- |SiteItemService|
* - urlTransformationService
- Service for transforming URLs, like transforming the content URL of a page to the web or render URL.
- |UrlTransformationService|
* - applicationContext
- Provides access to the Crafter Engine's Spring beans and site beans defined in config/spring/application-context.xml.
- |ApplicationContextAccessor|
* - globalProperties
- Provides access to global configuration properties defined in server-config.properties.
- `PropertySourcesPropertyResolver`_
* - navBreadcrumbBuilder
- Helper class that returns the list of path components in an URL, to create navigation breadcrumbs.
- |BreadcrumbBuilder|
* - navTreeBuilder
- Helper class that creates navigation trees to facilitate rendering.
- |NavTreeBuilder|
* - tenantsResolver
- Can be used to retrieve the Profile tenants associated to the current site.
- |TenantsResolver|
* - modePreview
- Can be used to check whether Engine is being executed in preview mode (also the value of the ``crafter.engine.preview`` property) e.g.

.. code-block:: html
:force:

<#if modePreview>
<!-- Preview-only markup or logic -->
</#if>

- Boolean
* - crafterEnv
- Indicates the value of the ``crafter.engine.environment`` property
- String
* - siteConfig
- The current site Configuration loaded from /config/site.xml.
- |XMLConfiguration|
* - siteContext
- The current SiteContext
- |SiteContextHashModel|
* - request
- The current request
- |HttpRequestHashModel|
* - requestParameters
- The parameter values for the current request
- `HttpRequestParametersHashModel`_
* - cookies
- The cookie values for the current request
- |Map|
* - session
- The current session
- `HttpSessionHashModel`_
* - locale
- The current locale for the current user
- |Locale|
* - authToken
- The current authentication (if the user has logged in), created by Spring Security
- |SpringAuthentication|

The following variables are provided for backward compatibility when using Crafter Profile, should be replaced
with ``authToken`` if possible:

+---------------------------+---------------------------------------+------------------------------------+
|| Name || Description || Type |
+===========================+=======================================+====================================+
|| authentication || The current authentication (if || |Authentication| |
|| || the user has logged in), || |
|| || created by the || |
|| || Crafter Security Provider || |
+---------------------------+---------------------------------------+------------------------------------+
|| profile || The current profile (if the || |Profile| |
|| || user has logged in), created || |
|| || by the || |
|| || Crafter Security Provider || |
+---------------------------+---------------------------------------+------------------------------------+
.. list-table::
:align: left
:header-rows: 1
:widths: 25 45 30

* - Name
- Description
- Type
* - authentication
- The current authentication (if the user has logged in), created by the Crafter Security Provider
- |Authentication|
* - profile
- The current profile (if the user has logged in), created by the Crafter Security Provider
- |Profile|

.. note::
The variables ``profile`` and ``authentication`` listed above will be null in most cases and should not be used anymore


The following variables are restricted by default, to use them see :ref:`configure-custom-services`

+---------------------------+---------------------------------------+------------------------------------+
|| Name || Description || Type |
+===========================+=======================================+====================================+
|| application || The servlet context || |ServletContextHashModel| |
+---------------------------+---------------------------------------+------------------------------------+
|| siteContext || The current SiteContext || |SiteContext| |
+---------------------------+---------------------------------------+------------------------------------+
.. list-table::
:align: left
:header-rows: 1
:widths: 25 45 30

* - Name
- Description
- Type
* - application
- The servlet context
- |ServletContextHashModel|
* - siteContext
- The current SiteContext
- |SiteContext|

.. |SiteItemService| replace:: :javadoc_base_url:`SiteItemService <engine/org/craftercms/engine/service/SiteItemService.html>`
.. |UrlTransformationService| replace:: :javadoc_base_url:`UrlTransformationService <engine/org/craftercms/engine/service/UrlTransformationService.html>`
Expand All @@ -118,4 +127,4 @@ The following variables are restricted by default, to use them see :ref:`configu
.. |Locale| replace:: See ``Locale`` under the ``java.util`` package of the ``java.base`` module in the `Java documentation <https://docs.oracle.com/en/java/javase/index.html>`__
.. |Authentication| replace:: :javadoc_base_url:`Authentication <profile/org/craftercms/security/authentication/Authentication.html>`
.. |Profile| replace:: :javadoc_base_url:`Profile <profile/org/craftercms/profile/api/Profile.html>`
.. |SpringAuthentication| replace:: See ``Authentication`` under ``org.springframework.security.core`` in the `Spring Security <https://docs.spring.io/spring-security/reference/index.html>`__ apidocs
.. |SpringAuthentication| replace:: See ``Authentication`` under ``org.springframework.security.core`` in the `Spring Security <https://docs.spring.io/spring-security/reference/index.html>`__ apidocs
Loading