Share via


Создание своего ContentType для Page Layout

? ???? ??????? ?? ???????? ???? content type ??? page layout ? ???????? ??? ? ??? ???????????? layout'?. ??? ???? ???? Content Type ?? ????? ???????? ? ????, ? ?????????? ??? ?? Publishing Page.

1. ???????? ???? feature.xml. ?? ???? ????????? ???? ??? ????? ? ??? ??????????????. ??? ??? ????? ??? ? ??? ????????. ? ??? ????? ? ? ???? ?????.  ? ??????? ?????? msdn ? google ??? ??????? ;).

<Feature  Id="0023C143-9E60-4277-A74F-048C7CAB5760"
          Title="PageLayoutTest"
          Description=""
          Version="1.0.0.0"
          Scope="Site"
          SolutionId="6FAD47E8-7622-4D57-93E1-9FE02F385181"
          xmlns="https://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
     <ElementManifest Location="ContentType.xml"/>
     <ElementManifest Location="CopyFiles.xml"/>
  </ElementManifests>
</Feature>

2. ???????? ???? ContentType.xml

<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
...... 

<!-- ??????? ???????? -->
 <ContentType ID="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900F164056CC3DA474096DD366224B5D804"
 Name="TestPageLayout"
 Group="Custom Content Types"
 Description="">
<FieldRefs>
<!-- ????? ????????? ?? ????, ????????? <FieldRef />  -->  

</FieldRefs>
 </ContentType>

.......

</Elements>

??????? ?????????? ? ?????????? ID ??? Content Types:

?????????????? ???????????? ?????? ???????.

0x0101 - ??????? ????, ??? ?? ??????????? ?? ?????????

x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39 - ??? ????????? ID Publishing Page

00 - ??? ???????????. ?? ??????????.

F164056CC3DA474096DD366224B5D804 - ??????????????? ???? ?????????????

3. ?????? ???????? ???? CopyFiles.xml ? ?????? ? ???????? ??? ContentType ? PageLayout ????????? feature

<Elements xmlns="https://schemas.microsoft.com/sharepoint/">

 <Module Name="PageLayouts" Url="_catalogs/masterpage" Path="PageLayouts" >

<File Url="TestLayout.aspx" Type="GhostableInLibrary"  >
    <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />
    <Property Name="PublishingAssociatedContentType" Value=";#TestPageLayout;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900F164056CC3DA474096DD366224B5D804;#" />
   </File>

 </Module>

</Elements>

??????????:

1) ??? ";" ?????? ????? TestPageLayout - ??? ?? ????????, ? ?????? ? ???? PublishingAssociatedContentType ????? ?? ??????????? ?????????.

2) ??? ????, ????? ??? ??????????, ?????????? ??????? ? ????? ? ????? ????? PageLayouts ? ???????? ? ??? ???? TestLayout.aspx

Comments