· CMS

Drupal 7 : what’s new ?

As a new alpha 7 version of Drupal has just come out it is now time to look into this version’s new features.

Changes for end users

Small details of general ergonomics have been improved on Drupal 7 : verification of password safety levels when registering, the choice of text format entry, removal of long refoldable fieldsets for the benefit of vertical tabs, automatic check of certain rights (by inheritance) in the list of access rights, homepage by default, a minimum installation profile (but let’s face it, it’s not at the same level as the demo site of eZ Publish).

But the main advantage of the interface is the project D7UX which totally revamps the back-office. Everything is brought together in the context of use :

  • I want to manage content (orange)
  • I’m building a website (blue)
  • I’m changing the design of my website (pink)
  • I’m managing people who are going on my website (green)
  • I’m configuring modules and parameters (grey)

Illustration in Drupal 5 and 6

png_d56-0d968

 

In Drupal 7

png_d7-2311c

And just to make everything easier, a toolbar which lists the most useful links in accordance with the user, comes as a bonus at the top of the website.

png_amdinbar-e4f76

 

At last, will be present : the new “seven” administration theme, overlays (like lightbox) and the “in-place” edition.

png_d7seven-a4594

png_d7seveninplace-b54fe

This new theme and a mock in-place publisher and the new toolbar are available for Drupal 6 when adding the “admin” module.

Changes for the administrators

  • New minimum required : PHP 5.2, MySQL 5.0 or PostgreSQL 8.3.
  • Better time zone support, better user removal management.
  • New internationalization interface, language management for search, and translations can vary depending on visualization context.
  • Native support of images. ImageAPI modules, imagecache, and filefield have been integrated in the core. Therefore, there will be a real “multimedia library” with creation of thumbnails on the fly.
  • With regards to security :
    • the PHP filter module has been revisited
    • the cron.php file which launches the cron file requires a key in the URL
    • Finally, there is a permission to launch basic updates (which means it will be possible to have several super-admin).
    • Better flood management at the login
    • Better password hashing algorithm

With regards to the core, the Blog API modules, Ping, Throttle and Upload have been removed. Blocks can be disabled, and rules of access are suppressed (the bit which said that a certain IP address or e-mail couldn’t register on the website). The number of words programmed for the body is removed ; the specific selection of the theme by users is also removed from the core.

The idea behind all this is core cleansing through removal of elements that will have a better dynamic as modules.

On the contrary, the following modules have been integrated to the core :

  • admin role
  • feed api
  • fileField
  • Image
  • ImageAPI
  • ImageCache
  • ImageField
  • Install profile API
  • Plugin manager
  • Poormanscron
  • Token

We will go through some of these modules in the section “for developers”.

But, above all, the main novelty added to the core is CCK ! In fact, not only CCK has been added, but a new concept is introduced : entities. An entity is a generic concept, in the same way that $node and $user were in Drupal 6. An entity will have a controller, it will be a real PHP object, and will therefore allow to add fields to the entities. This entity concept will change the entire way we concieve a Drupal website.

These are the following type of fields available :

  • boolean
  • decimal / float / integer
  • file
  • list
  • text / textearea
  • taxonomy term
  • body

Body will indeed be a field, which means that a node will now only be an aggregation of several fields. A field will not only be applied to a node, but also to a user (farewell Content Profile module), to a comment or to taxonomy terms, actually to all entities (please note that blocks won’t be an entity).

And all this is in the core, but other type of fields will add on via modules. The CCK module will always exist for that reason. Especially to add node reference which will be missing from the core.

Changes for designers and front-end developers

  • Table-based design themes from Drupal 4 are deleted from the core.
  • Many elements composing a page have now become blocks or regions (help message, page content : $content of page.tpl.php, footer message, for instance, are blocks).
  • An update of all .tpl.php files by default has been done with all CSS class names and more semantic identifiers, more consistency.
  • A new theme has been added : Stark which is an ultra minimalist theme, with nothing else, just the vital minimum to start a new theme.

$content is no longer a long string containing xHTML. $content is now a table of page components that saves what has been displayed. That way, via hide() and render()functions we can choose what and where we want to display.

On top of that, preprocess are now extended to theme() functions (and no longer to just thetheme() file). And now that there are fields everywhere, the RDFa support is available.

With regards to Javascript, transition from jQuery 1.2.6 to jQuery 1.4 and integration of jQuery Forms 2.2, and jQuery UI 1.7. The new drupal_add_library() function allows you to add javascript and css files in relation to each other, and a new AJAX framework has been incorporated to the core. The drupal_add_js() function has been improved and the Javascript API, often underused, remains intact.

Changes for developers

The main novelty comes from the integration of SimpleTest, which will allow unit and funtional test.

Then, the use of PDO to make a database abstraction (theoretical support of many SGBD) and support of master/slave replications, transactions, multiple insertions, etc.

With regards to the query, you can proceed in the same way (or almost) :

$node = db_query('SELECT nid, title FROM {node} WHERE type = :type AND nid = :nid', array(':type' => $type, ':nid' => $nid))->fetchObject() ;

But you can also make more dynamic queries :

$select = db_select('node', 'n')
->fields('n', array('nid'))
->condition('promote', 1)
->condition('status', 1)
->orderBy('sticky', 'DESC')
->orderBy('created', 'DESC')
->extend('PagerDefault')
->limit(variable_get('default_nodes_main', 10))
->addTag('node_access') ;

(which makes hook_query_alter() much easier)

With regards to the Field API :

  • Possibility to declare whichever entity
  • The data is stored through SQL query, but potentially could be done through calling webservices.

The API file management has been improved. Files are objects, new hook :hook_file_load(), hook_file_save(), hook_file_move(), etc. No need to manage the filestable, files are managed automatically.

A new hook allows the support of CDN with hook_file_url_alter(). Instead of referencing files through path, referencing through URI : schema://file/path/file.ext. which allows you to change the location of a file without having to carry out a database update. public://, private://, temp:// are natively supported, but modules may come and add s3://, filckr://, etc.

For the new Image API, toolkits are no longer files to copy, but full modules. Native support of image manipulations (previously the ImageCache module).

Performance

  • Addition of multi-loads(), e.g : node_load_multiple(), user_load_multiple(), etc.
  • Support of proxy, and reverse-proxy
  • A multitude of optimizations through profiling with XDebug has been carried out.
  • InnoDB becomes the method of default database backup.
  • CDN support for files.

Hooks and APIs

Farewell to $op variables, so no more hook_nodeapi(), hook_user(), hook_block(), for the benefit of more specific hooks, which only do one thing, with hook_node_load(),hook_node_update(), hook_user_register(), hook_user_login(), hook_block_list(),hook_block_view(), hook_form_FORM_ID_alter(), etc.

A new $page object and a new hook_page_alter() hook have also been introduced.

New bulk APIs : Roles/Permissions API, Filter/Format API, static cache mechanism, Locking framework, Job Queue.

Furthermore, the “Node Accesses” have been improved, when dealing with them in Drupal 6 was a nightmare.

So, more to the point, when will it be released

When it’s ready ! Which is when the list of critical bugs will be 0. Today, it’s about 20, and anyone can suggest a correction.

On top of all that, an adjustment period is necessary so that all essential modules be adapted to this version. A major project which goes by the code #D7CX has been launched to start the adaptation as quickly as possible. If all goes according to plan, Modules such as Views, Webform will be available as soon as Drupal 7 comes out. But developers and front-end developers will have to learn how to use this new tool properly because the changes are pretty wide.