To create a deployable page layout which uses a manage metadata field.
- Create a term store in central administration
- Create a content type (which inherits publishing page)
- Create a managed metadata site column using the above term store
- Associate the site column with the content type
- Create a page layout which uses this content type
Add editing ability to the page layout for the managed metadata field as below.
<PublishingWebControls:EditModePanel PageDisplayMode="Display" runat="server" CssClass="edit-mode-panel"> <SharePointWebControls:FieldValue FieldName="TeamCategory" runat="server"> </SharePointWebControls:FieldValue> </PublishingWebControls:EditModePanel> <PublishingWebControls:EditModePanel runat="server" CssClass="edit-mode-panel"> <Taxonomy:TaxonomyFieldControl DisableInputFieldLabel="true" FieldName="TeamCategory" runat="server"> </Taxonomy:TaxonomyFieldControl> </PublishingWebControls:EditModePanel>
The Page loads and saves the values correctly and works a charm. So now the steps are:
- Using the CKS dev tools,Import the site column and content type into a visual studio project.
- I have found that the managed metadata field has created an extra note field site column which I can in see in server explorer in visual studio. This has to be imported too.
- Create a module to install the page layout and correctly bind the content type to this page layout
- Install wsp on new site and test
I created a page using the new page layout in the new site and it loads fine. I put in edit mode and save some data in the managed metadata field. On clicking save, the data is saved (I can see it in SharePoint Manager 2010) but when the page loads, the field is still empty. Going into edit mode again shows this field to be blank. Looking at SharePoint logs does not show any issues are happening on save.
Any suggestions on how to fix this?