This project is not covered by Drupal’s security advisory policy.

The Builder modules is an experiment in generating drupal code from specifications provided as YAML files. With this module, I seek insight into how far the new reflection mechanisms like the Schema API and the Form API carry.

There is an example YAML spec for a node module in the config/ directory. The file specifies a set of content types in the types section.

I have deliberately refrained from providing a graphical user interface to specify things. For incremental updates, this is a limitation in that I won't be able to track what exactly has changed from one version of a YAML file to the next and e.g. automatically generate update functions for the installer. Because of this limitation, I do not consider this module a competition to the CCK or Views projects.

On the other hand, this module could be used to bootstrap a new generation of more complex modules like CCK and Views by generating the necessary metadata store for these.

Currently, the Builder module is able to generate node modules with simple field types. The boiler plate for the various hook implementations is mainly taken from the node example, but updated to use the new Schema API in Drupal 6. I consider the module an early Alpha version due to its functional limitations.

I plan to update the module to

  • know about a richer set of field types
  • provide standard theme functions for detail pages and node lists
  • shrink-wrap common queries to be used with node lists

To install, you need the SPYC YAML library. Download the tarball and unpack it into the module directory, which yields a subdirectoy spyc.

The module contains the specification of a simple content module in the config directory to get you started:

title: Content types
description: Generate modules for content types.

types:
  profile:
    title: User profile
    description: Holds additional information about a user.
    has_title: false
    has_body: false
    fields:
      given name:
        validate: plaintext
        description: All of your given names.
      surname:
        validate: plaintext
      number of kids:
        description: How many children do you have?
        type: int(tiny)
        size: 10
        maxlength: 10

The configuration consists of a list of content types that are converted into Drupal node modules. The info for each type combines the info given in a hook_node_info() with the field specs needed by the Schema API.

In addition to that, there are a few pieces of information related to the widgets in the node edit form. There is not much here yet, unfortunately.

Project information

  • Created by olav on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases