The state of the fieldgroup module for Drupal 7

With Drupal 7 getting closer to release and field API, better known as CCK in Drupal 6, in core, the fieldgroup module was still left behind a bit. While Yves Chedemois (yched) was working on making the Field UI extendable from contrib, I started testing and working further on brand new code that was available on github that is destined to become the fieldgroup*1 module for Drupal 7. My colleague Jochen Stals (Stalski) also jumped in and after some internal discussion with Yves, we moved the code into a new project, away from CCK. The new module is available at http://drupal.org/project/field_group. Exciting for sure, but where are we exactly and where are we going?

Fieldgroups are everywhere *2

Every entity (node, user, etc.) in D7 shares the same UI for managing the form and display. This means that fieldgroups are available for your user profile, taxonomy or even your own defined entity. Refreshing also is that the order of fields is separated from the form and display. A fieldgroup can thus be displayed on top of the form and at the bottom of say your node - or not at all, it all depends what and where you want to show your data. Oh, and there's also unlimited nesting.

Formatting

Different formatting options are available: div, collapsible fieldsets and vertical tabs. With the jQuery library in core, it's now much easier to format also in different stylish ways: horizontal tabs and accordion are already supported. People wanting other formats can simply implement a hook to register the format and an output callback function.

Regions and layouts

Since we can output fieldgroups as a div, they can serve as containers to create a multi column layout if the right css is made available. Create nice forms or layouts for easy positioning of elements of a node, user etc. in any view mode (build mode in Drupal 6). People familiar with Display suite know we love such stuff and we're discussing how the two modules can work nicely together. The solution lies in the #region key available in the form and which module will make use of it. There is even a chance that #regions is not even needed at all and can be ditched completely. This could lead to a change in the name of this module to something more abstract like Group.

Obsolete modules

It's not our first goal, but with the power we now have in core, a few modules can be merged or easily replaced by the new version of fieldgroup: CCK fieldgroup tabs and Node form columns are two that come to mind, we probably forgot a few more. We invite maintainers of such modules to help along to bundle forces and share thoughts what steps we need to take. Documentation and guidance are most likely the key factor in succeeding.

Exportables

The module will have full support for exportables and features. Whether we'll write it ourselves or depend on CTools has not been decided yet. Input from both parties are greatly appreciated here. However, when we release, fieldgroups will be able to live in code.

Upgrade path

The upgrade path is the most difficult task. The module has been rewritten from scratch and has a complete new database schema. There is no clear plan at this moment, so input is more than welcome. We can get inspiration from the upgrade path that is partially available from CCK to field API - although at this point a lot of problems are still there.

Multigroups

Multigroups is a concept living in CCK3 (1 and 2), but has had no official release yet to this date. Support in this module is not planned yet for that reason. The code is also a bit hackisch and shouldn't probably live here anyway. Fieldable fields is most likely the answer and belongs in another project. Insights are welcome of course.

Update http://drupal.org/node/939836 is a nice start for discussion around multigroups (Thanks Yched).

Working together

Getting the module out will benefit everyone, so please test, create patches (+ tests), write documentation or record some screencasts. With the new options available to maintain a project, we can give more people access to commit or other responsibilities. Feel free to jump in, the community will appreciate all your hard efforts in making this module a huge success!

*1 There is still an internal debate whether we are going to write 'field group' or 'fieldgroup' as the title of the module or even something else (see Regions and layouts)
*2 persiflage of 'fields are everywhere', taken from the haiku written by Amitaibu for his Organic Groups presentation at Drupalcon Copenhagen.

Tag your website with Banksy

I haven't come far in my search for Banksy and I didn't get any more clues after seeing Exit through the gift shop this week where to find him - actually, not even trying to find him, however, if you, yes you, Banksy, ever read this, just send me a mail, will you? Even a single dot will do.

Anyway, after doing art on the street, galleries and now the movie, it's time to hit the internet. So, a tiny brainstorm and a few javascript lines later, I came up with this button on which you can click underneath or drag in your bookmarks browser to tag any website with a random Banksy piece. Actually, 1 is not from him, but if you, yes you, Banksy, ever read this, just send me more and better stuff to tag sites with, will you ? Or someone who's better than me creating non pixelized pictures to work on sites with dark backgrounds ...

Banksy tag!

You can also drag that link to your bookmarks bar or a tab and start tagging other sites.

On internet explorer ? Right click and choose "Add to favorites" (yes, it's safe).

Topics 

jquery, banksy, tag

Benchmarks for the Display Suite module

I've been promising benchmarks for the Display Suite module after every presentation I gave so far. It took me a while to get a good setup but now it's here. I've used the demo site as a start, so there are a lot of modules enabled for this test. Views, panels, fivestar, heartbeat, comment, taxonomy, location, gmap, imagecache are the most important ones since they all integrate with the ecosphere of Display Suite modules. I added a new content type called 'benchmark' and added 14 CCK fields to it: 4 textfields, 4 textareas, 2 images, 2 filefields, 1 node reference and 1 user reference. It also has a title, body, 2 taxonomy fields, a fivestar widget and a couple of comments. Depending on the test, the complete set of modules integrating with Display suite are enabled or disabled. These include ds, ds_ui, cd, hds, nd, nd_cck, nd_search, nd_fivestar, nd_location, nd_switch_bm, ucd, ud and vd. You gotta love small project names right ?

Desktop

The first test was ran on my Fedora Core 13 desktop - Intel Core Quad, 2 GHz, 2MB RAM with php 5.2.13 and eAccelerator - ab sending 100 requests with 5 concurrent users on a single node and page caching disabled.

 Without Display Suite
PHP 4.91 MB
Requests per second: 36.18 [#/sec] (mean)
Time per request: 138.202 [ms] (mean)
Time per request: 27.640 [ms] (mean, across all concurrent requests)
 Build mode blocked
PHP 5.31 MB
Requests per second: 34.68 [#/sec] (mean)
Time per request: 144.174 [ms] (mean)
Time per request: 28.835 [ms] (mean, across all concurrent requests)
 With Display Suite
PHP 5.33 MB
Requests per second: 34.51 [#/sec] (mean)
Time per request: 144.876 [ms] (mean)
Time per request: 28.975 [ms]
(mean, across all concurrent requests)

Server

The second test was ran on a CentOS 5.3 - 2 x Intel Core Quad, 2,6 GHz, 8MB RAM with php 5.2.11 and eAccelerator - ab sending 100 requests from my pc to the external server with 5 concurrent users on a single node and page caching disabled.

 Without Display Suite
PHP 4.25 MB
Requests per second: 26.91 [#/sec] (mean)
Time per request: 185.775 [ms] (mean)
Time per request: 37.155 [ms] (mean, across all concurrent requests)
 Build mode blocked
PHP 4.61 MB
Requests per second: 26.76 [#/sec] (mean)
Time per request: 187.072 [ms] (mean)
Time per request: 37.514 [ms] (mean, across all concurrent requests)
 With Display Suite
PHP 4.63 MB
Requests per second: 26.65 [#/sec] (mean)
Time per request: 187.642 [ms] (mean)
Time per request: 37.828 [ms] (mean, across all concurrent requests))
I knew that enabling modules would cause the memory of PHP to grow on both my desktop and the server. The server however behaves better in terms of keeping the requests per second steady per setup, so that's the real good news. I'll probably run some more in the future to see how it behaves in other situations, but I'm glad that I've got some results to show! You may lose a few microseconds, but win days of maintainability!

Sweaver: a visual interface for tweaking your Drupal 6 theme

For the upcoming release of Conimbo, a Drupal distribution we're building at One Agency, we needed an easy and attractive way to theme your website without knowing anything of CSS. Having the opportunity to experiment once and a while during our free day at work, one of our colleagues started playing around with jQuery and manipulating the properties directly on the frontend - much like the Themebuilder created by Drupal Gardens, which he used as inspiration. After a while, I joined the coding part and sweaver was born - if you really want to know where the name comes from, that's all explained on Drupal.org.

Writing sweaver was interesting because of three reasons:

  • jQuery: we now probably know the jQuery manual by heart since we've had to look up a lot of new tricks to manipulate all kinds of stuff: iterating through all parents of a css selector, show/hide/close/open tabs and sliders, find out out the type of a selector and keeping it all manageable in a nice interface. It's been a tremendous ride so far and I'm pretty sure we've not reached the end of it.
  • CTools: sweaver uses the CTools plugins and exportables functionality. This means developers heaven both for us as maintainers, but also for other drupal people out there wanting to write their own plugin for this module. We're still into beta phase right now, so we might even use other functionality like object caching, Ajax and form tools.
  • Themes: we've learned that creating a re-usable theme isn't that easy, which is not even related to Drupal. Technology like cufon is fun, but clashed with our module. Switching to @font-face was something we've planned, but now got implemented faster. And I personally learned a lot of cool css tricks, but I'll stick with coding though :)

Interested and want to see how it looks like ? You can watch two video's we've created: a basic introduction and another where we show you how I've used the module to rebuild my own website. There is also a demo site where you can login and play around with it - not all plugins are enabled, but you should be able to create beautiful themes or hideous creatures :)

Downloads and more documentation is available on the project page on Drupal.org. It's important to know that we're still in development, so there are things that still act funky and might change completely during commits before a first release. Happy theming!

URL aliases: racing conditions and existing directories

Creating URL aliases on a Drupal site is a piece of cake. Core path in combination with pathauto and token modules are a real winner. However, there are some annoying cases which you should look out for because they can lead to painfull debugging sessions - especially when you've already encountered them in the past but totally forgot those. So for myself and all of you out there, here are 2 - in some way funny - URL alias pitfalls.

1. Existing directories

When you download Drupal and look at the root folder, you see a couple of subfolders like 'misc', 'sites', 'includes' etc. After installing, go to example.com/sites and you'll get the 403 forbidden page served by Apache (I assume the same happens on other webservers). This means you can't actually create an URL alias for a node (or a view, etc ..) called 'sites' or any of those other subfolders. The .htaccess will not rewrite to index.php?q= to lookup an existing path in your Drupal site or throw a 404 in case it doesn't exist. I've been experimenting with rewrite rules and while following code in the .htaccess will process the request for 'sites', do not use this in production because other http requests for images, javascript and css files in the sites/*/ folders will fail.

  # Again, don't use this in production!
  RewriteCond %{REQUEST_URI} "/sites/"
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

I gave up after a while - needed to solve this for a client - and simply renamed the URL alias for now. If anyone has a better idea, please let us know in the issue on d.o dedicated to this problem.

2. Racing conditions

This is really easy to reproduce: install the views module and enable the default frontpage view. Surf to example.com/frontpage and you'll get a list of all nodes promoted to frontpage. Now create a node and fill in 'frontpage' as the URL alias. You will be redirected to example.com/frontpage and you'll see your node instead of the view you have just enabled and there is absolutely no way to get back to that view unless you rename the alias of the node you've just created. This behaviour is very normal if you look at the code of drupal_lookup_path which is called by drupal_init_path in the bootstrap trying to rewrite the $_GET['q'] variable before menu_execute_active_handler() can find a path in the menu_router table. As with my first case, I simply had to rename the URL alias again to get my view back.

Any other pitfalls people know of ? Let me know!

Pages

Subscribe to realize.be RSS