Datamanager Schemas

flack edited this page Dec 8, 2016 · 7 revisions

Datamanager Schemas are used to configure Datamanager-powered forms. In spite of the similar-sounding name, they are not related to the MgdSchema XML files, which are used to describe the database table layout.

Almost all forms in Components are based on Datamanager Schemas, and their data structure as well as validation and other rules can be altered by user-defined Schemas. The default schema is usually located in config/


Here's an example of what a simple Datamanager Schema might look like:

'default' => array(
    'description' => 'article',
    'fields'      => array(
        'name' => array(
            'title'   => 'url name',
            'storage' => 'name',
            'type'    => 'urlname',
            'widget'  => 'text',
            'type_config' => array(
                'allow_catenate' => true,
        'title' => array(
            'title' => 'title',
            'storage' => 'title',
            'required' => true,
            'type' => 'text',
            'widget' => 'text',
        'abstract' => array(
            'title' => 'abstract',
            'storage' => 'abstract',
            'type' => 'text',
            'widget' => 'textarea',
        'content' => array(
            'title' => 'content',
            'storage' => 'content',
            'required' => true,
            'type' => 'text',
            'type_config' => array(
                'output_mode' => 'html'
            'widget' => 'tinymce',
        'related' => array(
            'title' => 'related stories',
            'storage' => 'extra3',
            'type' => 'select',
            'type_config' => array(
                 'require_corresponding_option' => false,
                 'allow_multiple' => true,
                 'options' => array(),
                 'multiple_storagemode' => 'imploded_wrapped',
            'widget' => 'autocomplete',
            'widget_config' => array(
                'clever_class' => 'article',
        'image' => array(
            'title' => 'image',
            'storage' => null,
            'type' => 'image',
            'type_config' => array(
                'filter_chain' => 'resize(800, 600)',
                'auto_thumbnail' => array(200, 200),
            'widget' => 'image',
            'hidden' => true,

Aside from specifying the data type, field name and storage location, Schemas are the place where widgets are assigned to content, and input validation can be triggered.

Schema fields have the following main properties:


This is used to tell the system where to store the contents of the field. These can be the fields the object has in the database. In addition to regular Midgard fields, two other possibilities exist:

  • parameter - store the content to a Parameter of the object

  • attachment - store the content to a file Attachment of the object

Furthermore, it is possible to specify null as the storage location, which means that no automatic storage will happen or tmp, which will save contents in a temporary object.


This defines the data type that is expected in this field


This defines the UI element that should be rendered to interact with the value

Creating custom Schemas

To create your own Datamanager Schema, just override the include path in the Component configuration:

 "schemadb"       => "path-to-my-schema",

path-to-my-schema should then include the schmea you want to use