Customize output of Design Manager Snippets in SharePoint 2013
-
10-12-2019 - |
Question
Is there a way to edit or customize the output of Design Manager Snippets in 2013?
If I create a snippet for a property containing a TaxonomyFieldMulti I get this
<div data-name="Page Field: Categories">
<!--CS: Start Page Field: Categories Snippet-->
<!--SPM:<%@Register Tagprefix="PageFieldTaxonomyFieldControl" Namespace="Microsoft.SharePoint.Taxonomy" Assembly="Microsoft.SharePoint.Taxonomy, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<!--MS:<PageFieldTaxonomyFieldControl:TaxonomyFieldControl FieldName="b009868e-1574-4327-b1da-488660ade3f4" runat="server">-->
<!--PS: Start of READ-ONLY PREVIEW (do not modify)-->
<div align="left" class="ms-formfieldcontainer">
<div class="ms-formfieldlabelcontainer" nowrap="nowrap"><span class="ms-formfieldlabel" nowrap="nowrap">Categories</span>
</div>
<div class="ms-formfieldvaluecontainer"></div>
</div>
<!--PE: End of READ-ONLY PREVIEW-->
<!--ME:</PageFieldTaxonomyFieldControl:TaxonomyFieldControl>-->
<!--CE: End Page Field: Categories Snippet-->
</div>
Which renders the following
<div data-name="Page Field: Categories">
<span title="Design Manager">Design Manager</span>
;
<span title="SharePoint 2013">SharePoint 2013</span>
</div>
Not exactly what I wanted, lets say I wanted an unordered list (UL) instead, is there a way to customize the output of these snippets?
Thanks
Solution
Ultimately these snippets are basically just for preview purposes - they would not change the actual server side rendering of the final components! You could change various settings, but mainly styling via CSS (http://msdn.microsoft.com/en-us/library/office/dn205275.aspx) but this won't affect the final results.
Exactly for the Metadata publishing field (PageFieldTaxonomyFieldControl:TaxonomyFieldControl is unfortunately Sealed - so no chance in overriding behavior of the rendering).
You should rather use the TaxonomyWebTaggingControl as described here http://pholpar.wordpress.com/2010/02/15/build-your-own-user-interface-components-using-the-taxonomy-controls/ - which should give you more control into the final rendering.
Still, with regards to the actual snippets themselves, there is not much you could do.