drupal

Drupal Modules

Woah, three of the modules I've written for Drupal are among the top 12 downloaded modules.

Drupal as a Metadata Framework

My latest Drupal project is a collaboration with John VanDyk, author of the Metadata Plugin for Manila. John also wrote a great walkthrough of Drupal's life-cycle that's worth reading, especially if you've never stepped through Drupal before. I've known and worked with John for many years, and this project is something we've wanted to build for quite a long time. It's a metadata-centric approach to content management.

Most content management systems use metadata only at the presentation level, lumping it in the same category as 'user navigational aids', such as breadcrumb trails. We feel metadata can easily drive both content AND functionality given a solid framework of schemas, metatypes and actions. In otherwards, metadata becomes a collection of tools used to shape the presentation and behavior of your site. Drupal has a foot forward in this arena with the taxonomy module. Our goal is to extend taxonomy module in three areas:

  1. Open vocabularies. User's should be allowed to add terms if they have permission to do so.
  2. The ability to render terms as any HTML form field, instead of select boxes only.
  3. If a vocabulary is storing numeric information, it should be stored in the database as a numeric type. The same holds true for string terms.

On a larger scale, we're also creating the ability to add metadata schemas to existing node types. We're not declaring new node types, but extending them with user-defined attributes (aka vocabularies). Say for example you want weblog entries with 'word of the day' and 'song of the day' features, here's how you'd do it:

  1. Add a new metatype (aka vocabulary) called 'word of the day'. Choose the string data type and specify that it should be displayed as a textfield. Optionally assign actions to the metatypes, such as validators and display properties. Do the same for 'song of the day'
  2. Create a new schema that extends the original blog node type. Name it and add your two metatypes.
  3. All schemas you create are visible on the 'create content' page. Click on your new blog schema and you'll notice the 'word of the day' and 'song of the day' form fields are present. Your blog entry is the same as any other blog entry except you've extended the definition of what it means to be a blog. The behavior of this metadata is much like the current behavior of taxonomy views, allowing you to list all content with like terms.

And there's no reason why you can't have multiple blog schemas as well! Now that makes life interesting, doesn't it? Imagine a corporate intranet where each department wants to use blogs to track different types of information. Schemas would make this approach much easier than manually writing different blog modules for each department.

Hold on, there's more. Once a metatype is created, it can be attached to any number of schemas. For example a keywords metatype will probably have the same function for most schemas. It is even possible to have hierarchial metadata values since we're building on top of Drupal's taxonomy system.

So far I have been very surprised how little the Drupal core code has been modified for this project. At this stage I can't offer any timeline on when we'll be finished, but if you're coming to OSCON, look us up and we'll be glad to show you a demo :-)

Img_assist Update

The img_assist module has been added to the Drupal contributions repository and with it several updates.

  • Previewing image thumbnails can be filtered by image categories so you don't have to view them all at once. (screenshots)
  • The generated code snippet can be viewed before it is inserted. This allows you to manually copy the code and paste it somewhere else.
  • There are now Drupal 4.4 and CVS HEAD versions of this module.

Here's the official Drupal project page to download the module.

New Drupal Imaging Module

The latest module i've concocted for the next release of Drupal is designed to make adding images to content easy without getting too caught up in HTML. It acts as a frontend to image.module, and thus does not upload images by itself. Here are the screenshots.

So what makes this different from all the other image-adding modules? I have no idea, i didn't look. But here's a list of things this one does:

Quickly add images

Step 1. Choose a thumbnail
Step 2. Click 'Insert image snippet'

Add borders, captions, adjust alignment and more...

With no need for any third party libraries.

Resizing maintains aspect ratio

When resizing an image, the dimensions of the image are locked by default in order to maintain the aspect ratio.

You control the output

The HTML code snippet generated by this module is user-defined. For example you can make all your images float to the right by default, or even link to the larger image.

Track where images are used

This module records to locations of all the links it generates. This allows you to generate blocks that inform your users where else this image appears. You can do this by enabling the 'Image reference' block. The block will be visible on the node/view/ page of any image with references.

Creates pure HTML with no Drupal filters

Previously in order to add an in-line image to a node you either had to use an image filter or straight HTML. This module creates the best of both worlds. The end result is HTML that does not need to go through the Drupal's sometimes expensive filtering system. And better yet, if you ever update your original image with a new one, the image links will still work. This is because the generated code snippet is using a reference to the image ID instead of the actual file.

Image Preview

You can view what the image will look like before changes are committed.


Only an interface

This module does not upload images, it only inserts images that are already on the server into content such as blogs and stories or any node type. This makes it a great interface for the image module.

So, in order to use this module, either you need the aforementioned image module installed or you need another module that does the following:

  1. Stores images as nodes
  2. Creates a database table called 'image' with at least the following column names:
    • image_path: the path to the image from the Drupal root.
    • width: image width
    • height: image height
    • nid: the node id of the image. Images must be nodes.

And now the download link:

http://drupal.org/node/view/8750

Getting Drupal up and Running

This tutorial is designed for the CVS HEAD tree as of Dec 30, 2003.

This tutorial assumes that you have successfully installed drupal and are ready to creat your first user account. If you haven't made it this far yet, be sure to revisit the INSTALL file that comes with drupal as well as the online documentation.

Creating the superuser account

The first step after a successful installation is to create the superuser account. This account allows an user to bypass all Drupal permissions and perform any action on the site. Only one account can be the superuser account, and it is strongly recommended that this account is used only when necessary and not for everyday use. The first account you create in Drupal will be the superuser account.

Go to the main page of your Drupal site and click the Create new account link

© 2007 Matt Westgate