MMBase Builder Configuration


Table of Contents

1. Introduction
2. Builder XML Format
2.1. <builder>
2.1.1. <status>
2.1.2. <class>
2.1.3. <searchage>
2.1.4. <names>
<singular>
<plural>
<names>
2.1.5. <descriptions>
<description>
<descriptions>
2.1.6. <properties>
<property>
<properties>
2.1.7. <fieldlist>
<field>
<descriptions>
<gui>
<editor>
<db>
A full field example

By installing applications or adding your own builder files you can expand the object types that can be used in MMBase.

Active builders are stored in the builders directory of the MMbase configuration directory. New MMBase installations only contain the core builders. In order to add an object type, you need to add a builder xml, with the name objecttype.xml somewhere in the builders directory.

You can make use of subdirectories to divide your builders in groups for easier maintenance. Note that the MMBase core builders are located under core, and that the applications by default install new builders under applications.

A builder file uses the following general format:

<?xml version="1.0" encoding="UTF-8"?>
<builder 
    xmlns="http://www.mmbase.org/xmlns/builder"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.mmbase.org/xmlns/builder
                        http://www.mmbase.org/xmlns/builder.xsd"
    name="..." maintainer="..." version="..." extends="...">
  <status>...</status>
  <class>...</class>
  <searchage>...</searchage>
  <names>
    <singular xml:lang="...">...</singular>
    ...
    <plural xml:lang="...">...</plural>
    ...
  </names>
  <descriptions>
    <description xml:lang="...">...</description>
    ...
  </descriptions>
  <properties>
    <property name="...">...</property>
    ...
  </properties>
  <fieldlist>
    <field>
      <descriptions>
        <description xml:lang="...">...</description>
        ...
      </descriptions>
      <gui>
        <guiname xml:lang="...">...</guiname>
        ...
      </gui>
      <editor>
        <positions>
          <input>...</input>
          <list>...</list>
          <search>...</search>
        </positions>
      </editor>
      <datatype base="..." xmlns="http://www.mmbase.org/xmlns/datatypes">
         ... (like in datatypes.xml)...
      </datatype>
      <db>
        <name>...</name>
        <type state="..." notnull="..." key="...">...</type>
      </db>
    </field>
    ... 
  </fieldlist>
</builder>
    

Most builders include less information than given here - since they can extend from each other, you only need to supply information that overrides the default, or when you add information such as fields.

The following sections explains the use and intention of each tag in detail.

The builder tag is the main tag. It's attributes define the builder's identity and place in the builder hierarchy. It is the parent of all other tags.


A field element can have three attributes 'name', 'readonly' and 'state'. The attribute 'name' is new introduced with datatypes and is required when you specify a fields datatype and omit the 'db' element which is not longer needed.

There are four states: the default state 'persistant' which you don not need to specify and the states 'virtual' for virtual fields 'system' and 'systemvirtual'. System fields are set by MMBase, like for example a field with the datatype 'lastmodified'.

<field name="updated" state="system">
  <datatype xmlns="http://www.mmbase.org/xmlns/datatypes" base="lastmodified" />
</field>

An example of a 'readonly' field is a field with the datatype 'creator'. It is necessary to specify a fields state otherwise you will get an input type="text" field in your editor instead of an entry that just displays a fields value.

<field name="creator" readonly="true"> 
  <datatype base="creator" xmlns="http://www.mmbase.org/xmlns/datatypes" />
</field>

This is part of the MMBase documentation.

For questions and remarks about this documentation mail to: documentation@mmbase.org