<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    xmlns:zcml="http://namespaces.zope.org/zcml"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    i18n_domain="plone.app.dexterity">

    <!-- this is necessary to use our beforeUninstall method in Extensions/Install.py -->
    <five:registerPackage package="." />

    <include package="plone.app.imaging"
             zcml:condition="installed plone.app.imaging"/>
    <include package="plone.app.jquerytools" />
    <include package="plone.app.z3cform" />
    <include package="plone.app.textfield" />
    <include package="plone.formwidget.namedfile" />
    <include package="plone.schemaeditor" />
    <include package="plone.directives.dexterity" />
    <include package="plone.dexterity" />
    
    <i18n:registerTranslations directory="locales"/>
    
    <genericsetup:registerProfile
        name="default"
        title="Dexterity Content Types"
        description="Configures various components needed for full Dexterity support."
        directory="profiles/default"
        provides="Products.GenericSetup.interfaces.EXTENSION"
        for="Products.CMFPlone.interfaces.IPloneSiteRoot"
        />

    <include package=".browser" />
    <include package=".behaviors" />
    <include package=".upgrades" />
    
    <include file="events.zcml" />
    
    <class class="plone.dexterity.content.DexterityContent">
        <!-- Make Dexterity types portlet- and content rule aware -->
        <implements interface="plone.portlets.interfaces.ILocalPortletAssignable" />
        <implements interface="plone.contentrules.engine.interfaces.IRuleAssignable" />
        <!-- Make it possible to traverse to image scales on Dexterity content -->
        <implements interface="plone.namedfile.interfaces.IImageScaleTraversable" />
    </class>

    <!-- override add views -->
    <include package="Products.CMFCore" />
    <include package="plone.app.content" />
    <include package="plone.app.contentmenu" />

    <!-- hide profiles for our widget/field dependencies -->
    <utility
        factory=".integration.HiddenProfiles"
        provides="Products.CMFPlone.interfaces.INonInstallable" />
    <utility
        zcml:condition="installed Products.CMFQuickInstallerTool"
        factory=".integration.HiddenProfiles"
        provides="Products.CMFQuickInstallerTool.interfaces.INonInstallable" />

    <!-- Register GS exporter for DexterityFTI type -->
    <adapter
        factory="Products.CMFCore.exportimport.typeinfo.TypeInformationXMLAdapter"
        for="plone.dexterity.interfaces.IDexterityFTI
             Products.GenericSetup.interfaces.ISetupEnviron"
        />
    
    <adapter factory=".interfaces.TypeIdValidator" />
    <adapter factory=".interfaces.TypeTitleValidator" />

</configure>
