Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-9432

The xsl stylesheet of the signup service should be more factorized

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 4.2.0
    • None
    • None
    • None
    • 4.2 M8

      For example to override the textarea field of the form stylesheet of the plugin WEB (master\main\plugin-web\pages\services\contenttype\helper\form.xsl) call a template a "contenttype-form-field-string-textarea" to be able to override this template only and not the whole contenttype-form-field-string template :

      <xsl:template name="contenttype-form-field-string">
              <xsl:param name="fieldPath" />
              <xsl:param name="value" />
              <xsl:param name="errors" />
              <xsl:param name="uniqueId" />
              
              <xsl:variable name="error"><xsl:value-of select="$errors[@name = $fieldPath]/error"/></xsl:variable>
              
              <div id="field-{$fieldPath}-{$uniqueId}" class="field">
              
                  <xsl:if test="$error">
                      <xsl:call-template name="contenttype-form-field-error" >
                          <xsl:with-param name="error" select="$error" />
                      </xsl:call-template>
                  </xsl:if>
                  
                  <xsl:call-template name="contenttype-form-field-label" >
                      <xsl:with-param name="fieldPath" select="$fieldPath" />
                  </xsl:call-template>
                  <xsl:choose>
                      <xsl:when test="enumeration">
                          <div id="input-{$fieldPath}-{$uniqueId}" class="select">
                              <xsl:if test="$errors[@name = $fieldPath]/error">
                                  <xsl:attribute name="class">select invalid</xsl:attribute>
                              </xsl:if>
                              <select id="{$fieldPath}-{$uniqueId}" name="{$fieldPath}">
                                  <xsl:if test="value != ''"><xsl:attribute name="value"><xsl:value-of select="$value"/></xsl:attribute></xsl:if>
                                  <option value=""><i18n:text i18n:key="PLUGINS_WEB_FRONTOFICE_FORM_SELECT_NONE" i18n:catalogue="plugin.web"/></option>
                                  <xsl:for-each select="enumeration/option">
                                      <xsl:copy-of select="."/>
                                  </xsl:for-each>
                              </select>
                          </div>
                      </xsl:when>
                      <xsl:otherwise>
                          <div id="input-{$fieldPath}-{$uniqueId}" class="input">
                              <xsl:if test="$errors[@name = $fieldPath]/error">
                                  <xsl:attribute name="class">input invalid</xsl:attribute>
                              </xsl:if>
                             <xsl:choose>
                                  <xsl:when test="widget = 'edition.textarea'">
                                      <xsl:call-template name="contenttype-form-field-string-textarea">
                                      	<xsl:with-param name="fieldPath" select="$fieldPath" />
      							        <xsl:with-param name="value" select="$value" />
      							        <xsl:with-param name="errors" select="$errors" />
      							        <xsl:with-param name="uniqueId" select="$uniqueId" />
                                      </xsl:call-template>
                                  </xsl:when>
                                  <xsl:otherwise>
                                      <input id="{$fieldPath}-{$uniqueId}" type="text" name="{$fieldPath}">
                                          <xsl:if test="$value != ''"><xsl:attribute name="value"><xsl:value-of select="$value"/></xsl:attribute></xsl:if>
                                      </input>
                                  </xsl:otherwise>
                             </xsl:choose>
                          </div>
                      </xsl:otherwise>
                  </xsl:choose>
                  <div class="field-end"></div>
             </div>
          </xsl:template>
          
          <xsl:template name="contenttype-form-field-string-textarea">
          	<xsl:param name="fieldPath" />
              <xsl:param name="value" />
              <xsl:param name="errors" />
              <xsl:param name="uniqueId" />
              
          	<textarea id="{$fieldPath}-{$uniqueId}" name="{$fieldPath}">
                  <xsl:if test="$value != ''"><xsl:value-of select="$value"/></xsl:if>
              </textarea>
          </xsl:template>

            laurence Laurence Aumeunier
            llopez Laure Lopez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: