Git Product home page Git Product logo

plone.app.contenttypes's Introduction

https://api.travis-ci.org/plone/plone.app.contenttypes.png?branch=master

plone.app.contenttypes provides default content types for Plone based on Dexterity.

It contains the following types:

  • Collection
  • Document
  • Event
  • File
  • Folder
  • Image
  • Link
  • News Item

These types are editable and extendable through-the-web and you can add or remove fields and behaviors using the control-panel "Dexterity Content Types" (/@@dexterity-types).

This package is included in Plone 6 and does not need installation.

Schemata that are defined in XML-files using plone.supermodel allow editing those types' schemata through the web. This is the case for the default File, Image and Link content types. Schemata coming from behaviors, on the other hand, are not editable through the web. The Document, News Item, Folder and Event default types, for example, have no schemata of their own at all, all their fields are provided by behaviors.

You have several options:

  1. Extend the types through-the-web by adding new fields or behaviors in the types-controlpanel /@@dexterity-types.

  2. Extend the types with a custom type-profile that extends the existing profile with behaviors, or fields.

    You will first have to add the type to your [yourpackage]/profiles/default/types.xml.

    <?xml version="1.0"?>
    <object name="portal_types" meta_type="Plone Types Tool">
      <object name="Folder" meta_type="Dexterity FTI" />
    </object>

    Here is an example that enables the image-behavior for Folders in [yourpackage]/profiles/default/types/Folder.xml:

    <?xml version="1.0"?>
    <object name="Folder" meta_type="Dexterity FTI">
     <property name="behaviors" purge="False">
      <element value="plone.app.contenttypes.behaviors.leadimage.ILeadImage"/>
     </property>
    </object>

    By adding a schema-definition to the profile you can add fields.

    <?xml version="1.0"?>
    <object name="Folder" meta_type="Dexterity FTI">
     <property name="model_file">your.package.content:folder.xml</property>
     <property name="behaviors" purge="False">
      <element value="plone.app.contenttypes.behaviors.leadimage.ILeadImage"/>
     </property>
    </object>

    Put the schema-xml in your/package/content/folder.xml (the folder content needs a __init__.py)

    <model xmlns:security="http://namespaces.plone.org/supermodel/security"
           xmlns:marshal="http://namespaces.plone.org/supermodel/marshal"
           xmlns:form="http://namespaces.plone.org/supermodel/form"
           xmlns="http://namespaces.plone.org/supermodel/schema">
      <schema>
        <field name="teaser_title" type="zope.schema.TextLine">
          <description/>
          <required>False</required>
          <title>Teaser title</title>
        </field>
        <field name="teaser_subtitle" type="zope.schema.Text">
          <description/>
          <required>False</required>
          <title>Teaser subtitle</title>
        </field>
        <field name="teaser_details" type="plone.app.textfield.RichText">
          <description/>
          <required>False</required>
          <title>Teaser details</title>
        </field>
      </schema>
    </model>

You could alternatively override the peroperty model_file of the type-definition with a empty string and use the property schema to provide your custom python-schema.

For more complex features you should always consider create custom behaviors and/or write your own content-types since that will most likely give you more flexibility and less problem when you want to upgrade to a newer version in the future.

For more information on custom dexterity-types and custom behaviors please read the dexterity documentation.

If you changed the base-class of existing types (e.g. because you changed them to be folderish) you also need to upgrade the base-class of existing objects. You can use the following form for this: @@base_class_migrator_form.

This form lets you select classes to be updated and shows the number of objects for each class. This form can be used to change the base-class of any dexterity-types instances. The migration will also transform itemish content to folderish content if the new class is folderish. You might want to use the method plone.app.contenttypes.migration.dxmigration.migrate_base_class_to_new_class in your own upgrade-steps.

Contributors please read the document Process for Plone core's development

Sources are at the Plone code repository hosted at Github.

GNU General Public License, version 2

plone.app.contenttypes's People

Contributors

pbauer avatar mauritsvanrees avatar thet avatar jensens avatar tisto avatar esteele avatar agitator avatar jaroel avatar gforcada avatar ale-rt avatar kroman0 avatar davisagli avatar csenger avatar do3cc avatar vangheem avatar mmulich avatar gbastien avatar pabo3000 avatar joka avatar fgrcon avatar datakurre avatar ericof avatar reinhardt avatar petschki avatar hvelarde avatar vincentfretin avatar lentinj avatar saily avatar cekk avatar folix-01 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.