Extend Default Content Types

Most of the fields of Plone default content types come from behaviors. To modify them you can make your product to override some properties.

Under the profiles/default/types add the Type.xml with the properties you want to override.

A quick example of how to make News Item folderish:

interfaces.py

# -*- coding: utf-8 -*-
from plone.app.contenttypes.interfaces import INewsItem as INewsItemOriginal

class INewsItem(INewsItemOriginal):
    """ Folderish News """

Note I subclass News Item Interface to have available the views registered to the original interface

contents.py

# -*- coding: utf-8 -*-
from plone.dexterity.content import Container
from zope.interface import implementer
from .interfaces import INewsItem

@implementer(INewsItem)
class NewsItem(Container):
    """Convenience subclass for ``News Item`` portal type
    """

profiles/default/type/News_Item.xml

<?xml version="1.0"?>
<object
    i18n:domain="plone"
    meta_type="Dexterity FTI"
    name="News Item"
    xmlns:i18n="http://xml.zope.org/namespaces/i18n">
    <!-- Hierarchy control -->
    <property name="filter_content_types">False</property>
    <property name="klass">my.product.contents.NewsItem</property>
    <property name="schema">my.product.interfaces.INewsItem</property>
</object>
2 Likes