Hi!
I’ve been trying to use CIF XML files for creating automatic content in a package. I couldn’t find much documentation about this.
After looking into concrete’s build-in themes xml files and many times failing and trying again I was able to create a new pagetype almost correctly.
But somehow the new pagetype’s composer got so many duplicated formlayout sets. It seems it is always creating a new formlayout set, when I do the xml-file install again. Is this supposed to happen and can I prevent it somehow? Should I always delete the pagetype before installing CIF content again (and how to do that)?
So the pagetypes composer form looks like this:
There’s the CIF I’m using (install/page_types.xml):
<?xml version="1.0"?>
<concrete5-cif version="1.0">
<pagetypes>
<pagetype name="News Entry" handle="news_entry" is-frequently-added="1" launch-in-composer="1">
<pagetemplates type="custom" default="news">
<pagetemplate handle="news" />
</pagetemplates>
<target handle="page_type" package="" pagetype="news"/>
<composer>
<formlayout>
<set name="Post Details">
<control custom-template="" custom-label="Entry Name" type="core_page_property" handle="name"/>
<control custom-template="" custom-label="" type="core_page_property" handle="url_slug"/>
<control custom-template="" custom-label="Short Description" type="core_page_property"
handle="description"/>
<control custom-template="" type="core_page_property" handle="publish_target"/>
</set>
<set name="Content">
<control custom-template="" custom-label="" type="collection_attribute" handle="thumbnail"/>
<control custom-template="" custom-label="" output-control-id="6y4mB58T" type="block"
handle="content"/>
</set>
</formlayout>
<output>
<pagetemplate handle="news">
<page name="" path="" filename="" pagetype="news_entry" template="news" user="admin"
description="" package="subnet_theme">
<area name="Page Header">
<blocks>
<block type="breadcrumbs" name="" mc-block-id="auf8nvkdiz">
<data table="btBreadcrumbs">
<record>
<includeCurrent><![CDATA[0]]></includeCurrent>
<ignoreExcludeNav><![CDATA[1]]></ignoreExcludeNav>
<ignorePermission><![CDATA[0]]></ignorePermission>
</record>
</data>
</block>
<block type="page_title" name="" custom-template="byline.php"
mc-block-id="3zXqs3ea">
<data table="btPageTitle">
<record>
<useCustomTitle><![CDATA[0]]></useCustomTitle>
<titleText><![CDATA[[Page Title]]]></titleText>
</record>
</data>
</block>
</blocks>
</area>
<area name="Main">
<blocks>
<block type="core_page_type_composer_control_output" name="" mc-block-id="YVfXXxWY">
<control output-control-id="6y4mB58T"/>
</block>
</blocks>
</area>
<area name="Sidebar">
<blocks>
<block type="next_previous" name="" mc-block-id="71azOVYD">
<data table="btNextPrevious">
<record>
<nextLabel><![CDATA[Next Article]]></nextLabel>
<previousLabel><![CDATA[Previous Article]]></previousLabel>
<parentLabel><![CDATA[]]></parentLabel>
<loopSequence><![CDATA[0]]></loopSequence>
<orderBy><![CDATA[chrono_desc]]></orderBy>
</record>
</data>
</block>
</blocks>
</area>
</page>
</pagetemplate>
</output>
</composer>
</pagetype>
<pagetype name="News" handle="news" package="subnet_theme" launch-in-composer="1">
<pagetemplates type="custom" default="full">
<pagetemplate handle="full"/>
</pagetemplates>
<target handle="all" package=""/>
<composer>
<formlayout>
<set name="Details">
<control custom-template="" type="core_page_property" handle="name"/>
<control custom-template="" custom-label="" type="core_page_property" handle="publish_target"/>
</set>
</formlayout>
</composer>
</pagetype>
</pagetypes>
</concrete5-cif>
And in controller.php I’m using this to install content:
$this->installContentFile('install/page_types.xml');
Thanks!