5 New Things In Drupal 7

20th January 2011 - 6 minutes read time

A couple of weeks ago saw the release of Drupal 7 so I thought I would run through a few new features that might be of interest. This certainly isn't a comprehensive list of new things as there is a lot of changes in this new version.

1 - Admin Interface
Drupal 7 comes with a nice new admin interface that has gone through lots of usability testing and redesign which has resulted in two new themes being bundled with the system. The admin interface is powered by a brand new bundled theme called Seven, the new front end theme is called Bartik. The old Garland theme is still there, but isn't enabled, so you can still use if you feel the need. Some of the older table based themes have now gone in favour of these new themes. The new Overlay module makes it easier to administer Drupal by displaying the admin pages as a layer over the current page, rather than moving the user around the site.

2 - Database Layer
The database interface in Drupal 7 has been completely rewritten from the ground up. Access to the database is now controlled through a PDO layer, which means that you can now (theoretically at least) plug in any database you like, rather than just MySQL. There is no db_fetch_object() or db_fetch_array() functions so running select queries is now a little easier. Also, instead of having to use db_query() for everything you now have the option of using one of the db_select(), db_insert(), db_update() or db_delete() functions to interact with your data. All of these functions are just abstraction functions for the main Database object so it is possible to use this directly as well.

Useful Resources:
Drupal 7 Database API Manual
Drupal 7 Database API

3 - Themes
There are lots of changes to the theme layer in Drupal 7, but the main difference is that most items are now passed to the template files as an array, rather than a pre-rendered string. Taking the node template as an example, the content of the node is passed separately from the links and comments and printed onto the page through the use of the render() function. Two functions called show() and hide() make it possible to turn on and off the rendering of certain parts of the array, which gives a lot more flexibility previous versions had. There is another core template type included called html. This is designed to contain the page template and allow for headers and footers to be defined in a single file.

Useful Resources:
Drupal 7 Theme API

One other thing I should mention here is the inclusion of a theme called Stark. This is a "bare bones" theme that contains no templates or code of its own. This is designed to be used by theme developers who want to see exactly the HTML that is being produced by Drupal.

4 - CCK
Most of the CCK module is now in core so it is now possible to create extra fields for nodes. This is how taxonomy elements are now added to the node forms; you need to add the vocabulary field to each node type you want to display them on. The upshot of this is that you can now move the taxonomy field around the node form and even place it into groups, rather than them always being a separate element as was the case in Drupal 6. The CCK module is still available on drupal.org to install but it mainly exists for content migration from Drupal 6 to Drupal 7 and a few miscellaneous field functions not handled by core.

5 - Module Download
If you are tired of downloading, unzipping and FTPing files just to get a single module installed then you'll be pleased to know that Drupal 7 comes with a neat auto-downloader for modules. To use it just go into the module admin page and click on the "Install new module" link at the top. You can now either upload the module tar.gz file directly or just give a link to the file on the drupal.org site (or wherever you have it hosted). The module will be unzipped and placed in the correct directory ready for you to activate it.

In my opinion Drupal 7 isn't quite ready for production use, but only because some of the really useful modules (like Views for example) haven't got a stable release yet and are still in beta or even alpha versions. I have tried a few of them out and most of them appear to work quite well, whilst others will throw errors all over the place. However, lots of modules are starting to release full versions so I think it will be only a matter of weeks before I start to seriously think about starting a project in Drupal 7. Of course, this decision should be made on a project by project basis as some modules probably won't be ready for a while yet, and if you really need to use something like Simplenews then it might be best to go for Drupal 6 for now. Of course, if you really need Simplenews in Druapl 7 you could always contribute to the project?

Add new comment

The content of this field is kept private and will not be shown publicly.