If you are planning to add Drupal blocks to your website you can try boxes instead. Boxes module is a reimplementation of the custom blocks that the core block module provides. This makes it do things that cannot be achieved with the blocks. This module offers a much more powerful alternative to the default block system. In simple words, a box is simply a block, but with extra features that help you incorporate advanced functionalities to your website. The boxes module provides an in-line interface for editing blocks. This feature allows you to change the contents of blocks without going to an admin page.
When to Use the Custom Blocks?
Blocks module usually finds use when it comes to creating features such as ‘User Login’ block that comes along with various modules. But, what if you wanted to add a snippet, a custom form or custom text to your website? Doing so becomes tough with the block module and this is where you should consider using Boxes.
Getting Started With Using Boxes
To get started with using boxes you will need to download and enable Boxes. You will come across a new link on the blocks administration page at admin/structure/block. Here, you will come across many new features and functionalities that make your job of designing and developing a website easy.
Custom Machine Name
Once you have enabled the boxes module, a box will be created and get a custom machine name. However, you can easily give this box your custom name. It can be named email_subscription or contact_form or whatever you want it to be. Now, the advantage of this function goes beyond naming it. The advantage is that the box will render with a custom ID, like block-boxes-email-subscription or block-boxes-custom form. This unique ID helps you add custom features to the box with CSS. If you had used a block module, you would have to settle for a generic ID such as block-block-3. To change the ID, you will need to rearrange the blocks. However, this ID cannot be used for CSS styling. For styling a particular block, you will again need to rely on the box module.
Custom CSS Classes
Another great advantage that comes along with the use of the boxes module is the fact that you can add additional CSS classes to the box. This is quite an awesome thing to have as it eases the process of creating several boxes, provided that they share some common formatting. You can assign the same class to the boxes rather than having to add each ID to the CSS code, which is what you shall have to do if you are making use of the block module. This speeds up the development process.
Editing Is Easy
It takes just one click of the mouse button to edit the box. Once you have saved a new box and placed it anywhere on your website you will come across a small link ‘Edit Box’. To edit the box, you need to click on the link. However, this is not as easy if you are using the block module. Here, you will need to find the block in a long list and click on the configure link to make edits.
Manage Boxes and Blocks with Context
To manage boxes, you can make use of the same tools that are used to manage blocks. Boxes show up in the same administration page as blocks. Thus, you won’t have any problems migrating from using blocks to using boxes. You can manage both boxes and blocks using the Context module. This extra site management tool is necessary as without using it each and every box shall appear on every page of your website. While configuring individual block, you have the option of restricting it to certain pages, content types, roles, or users. However, you have no such option with boxes. This downside can easily be overcome by making use of the Context module.
All in all you can clearly see that the boxes module is much more efficient and productive compared to using the blocks.