CMS Ametys provides integrators with numerous methods accessible from XSLT files, facilitating the integration of user-related information.
For more information, click here.
Add this code to the header of XSL files:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ... xmlns:ametys="org.ametys.plugins.userdirectory.transformation.xslt.UserXSLTHelper" ... extension-element-prefixes="... ametys ...">
So that you can call any of the functions defined below, using "ametys:functionName(argument1, argument2)".
Description:
Returns the identifier of the "User" content linked to a user.
The language of the returned content will be:
Signature :
String getUserContent(String lang, String userIdentity)
Arguments:
Name |
Type |
Description |
---|---|---|
lang |
String |
Preferred language for content. Can be empty or null. |
userIdentity |
String |
User identity in the form login#population |
Description :
Returns the identifier of the "User" content linked to the current user.
The language of the returned content will be:
Signature :
String getCurrentUserContent(String lang)
Arguments:
Name |
Type |
Description |
---|---|---|
lang |
String |
Preferred language for content. Can be empty or null. |
Example:
<xsl:variable name="userContentId" select="user:getCurrentUserContent(ametys:lang())"/> <p><strong>Fonction: </strong><xsl:value-of select="ametys:contentMetadata($userContentId, 'function')"/></p>
Description :
Returns the identifier of the directory page linked to the current user, in the current site.
Return to null if no page exists for the current user.
Signature :
String getCurrentUserPage(String lang)
Arguments:
Name |
Type |
Description |
---|---|---|
lang |
String |
Preferred language for content. Can be empty or null. |
Example:
<xsl:variable name="currentUserPageId" select="user:getCurrentUserPage(ametys:lang())"/> <xsl:if test="$currentUserPageId != ''"> <a href="{resolver:resolve('page', $currentUserPageId, false)}">Voir mon profil</a> </xsl:if>
Description :
Returns the identifier of the directory page in the current site, linked to "User" content.
Return to null if no page exists for the user in the current site.
Signature :
String getUserPage(String contentId)
Arguments:
Name |
Type |
Description |
---|---|---|
contentId |
String |
User content identifier |
Example:
<xsl:variable name="page-id" select="user:getUserPage(@id)"/> <a href="{resolver:resolve('page', $page-id, false)}"> <xsl:value-of select="metadata/title"/> </a>
Description :
Returns the identifier of the directory page linked to "User" content and a given site.
Return to null if no page exists for the user in the given site.
Signature :
String getUserPage(String contentId, String siteName)
Arguments:
Name |
Type |
Description |
---|---|---|
contentId |
String |
User content identifier |
siteName |
String |
Site name |