What the Heck is a Drupal Bean?

Janet Manning // March 2017

I am not talking about green, brown or black beans here! In the Drupal Module world, “Bean” stands for “Block Entities Aren’t Nodes.” I don’t know about you, but that doesn’t tell me much!

Drupal 7 Bean Module

When me and my colleagues at Isovera are mapping out a design and development project, our goal is to create a beautiful site with an amazing user and admin experience. Building highly flexible and scalable sites is at the top of our priority list - always. Creating a concise and comprehensive content model paves the way to the success of most projects; and, when underway, we consider all aspects of the content and how it will be viewed and administered.

There are many awesome Drupal 7 modules and core components for managing content at our disposal. One option on the table for many Drupal 7 projects is the Drupal Bean module. This module provides additional block creation abilities that are built on the entity design concepts (similar to taxonomy, user, node) and can use the Context module (You just stumbled on the topic of my next blog post!), Panels, Display Suite, etc. Another nice feature is that bean blocks can also be referenced from a field reference too, providing the ability to create an unlimited number of contextual-based layouts. Bean-blocks have flexibility in display and a very intuitive admin interface (easily usable by content authors and editors), with the ability to set up Bean-specific permissions. Bean-blocks are much more robust and powerful than the ‘standard’ block and are super easy to use!

So, now that we know that Beans are awesome, let’s discuss how that awesomeness manifests itself. We are all familiar with creating content types - you can basically add whatever fields and displays you want, making content authoring fairly straightforward. We are also familiar with creating blocks and placing those blocks on pages; at times definitely not straightforward. What’s great about Beans is that they are, in essence, a block that acts like a content type! For example, instead of creating a view and a block, and then placing the block on one or more pages - you can simply create one or more Bean-blocks with any number of fields in them, and use them wherever you want on a site.

When the Drupal 7 Bean module and the Bean Admin UI module are installed and turned on, you can basically point-and-click your way through building reusable bean-blocks. Adding something like a reusable block that has an image in it is simple because creating a bean-block is the same as building a node. Instead only being able to build a generic block with just text, you can create a block that has fields in it, with the ability to manage those fields and the display of them. Whoa, right? Isovera implemented Beans on Pegasystems’ SalesHub, an “internal sales enablement website featuring essential tools to empower their sales team” with great success!

Great news: Bean functionality is included in Drupal 8 core (yay!) with a standard set of blocks (e.g., Page Title, Menus and Help); any number of custom blocks can be added to the Custom Block Library. Take a look at what the Drupal 8 custom block admin page looks like below. If you are working in Drupal 8, enjoy the new Bean-like features of Blocks! If you are working in D7, you have one more great reason to move to D8! If you can’t do that, start considering Beans for your next project!

Janet Manning Headshot

Janet Manning

Engagement Manager/Training Coordinator

I partner with internal and client creative and technical teams to build  beautiful, flexible and scalable sites with an amazing user and admin experience. Once a project is underway, I work closely with the design and development team to keep projects on time, on budget and within scope.

Filed under: