Deleting the contentMetadata method


This page should only be used if the script asks you to pass the code.20240828 manual migration.CMS-ContentMetadata

The contentMetadata method of the AmetysXSLTHelper has been removed. Calls must be replaced by the contentAttribute method.

These methods retrieve the value of a specific data item, whose path is passed as a method parameter. The parameters of the 2 methods are identical. However, their results may differ.

Simple types

For simple data types (String, Long, Double, Boolean, date, datetime), there is no difference. The method can be replaced directly:

<xsl:variable name="firstname" select="ametys:contentMetadata($userContentId, 'firstname')"/>

can simply be replaced by 

<xsl:variable name="firstname" select="ametys:contentAttribute($userContentId, 'firstname')"/>

Complex types

For more complex data types, there may be differences. For example, to get the identifier of a content data type, you'll need to add @id after the call:

<xsl:variable name="orgunitId" select="ametys:contentAttribute($contentId, 'orgUnit')/@id"/>
Back to top