Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Why Use Bean and the Advantages it Provides

Video loading...

  • 0:00
    Context and Bean Layout Tools for Drupal
  • 0:00
    Overview of the BeanModule with Kyle Hofmeyer
  • 0:08
    Context is a really great tool when
  • 0:11
    it comes to laying out blocks on our site.
  • 0:13
    This is great, especially if we are laying out blocks provided by Views
  • 0:16
    and other modules, but what if we still
  • 0:18
    want to use regular old blocks?
  • 0:20
    Because the root of the block system and core is not exportable,
  • 0:22
    we want to bring in another module that not only gives us the ability
  • 0:25
    to have blocks exportable, but gives us
  • 0:27
    a ton more functionality than the core block system.
  • 0:30
    Here's where the Bean module is a great complement to Context.
  • 0:35
    In this lesson, we will take a look at the advantages of the Bean
  • 0:38
    module, some disadvantages, and some enhancements
  • 0:42
    it offers us over the core block system.
  • 0:47
    Now that we've learned about the Context module and the advantages
  • 0:50
    it gives us over the core block system, another module
  • 0:53
    that I like to use with the Context module is the Bean module, which
  • 0:57
    stands for Block Entities Aren't Nodes.
  • 1:02
    Basically, the Bean module takes care of all the situations
  • 1:05
    in the past where we used to use nodes instead of blocks,
  • 1:09
    such as the Nodes in Block module, so we
  • 1:11
    basically have a more powerful block.
  • 1:13
    That's what Bean does for us.
  • 1:15
    It gives us the ability to add fields to blocks.
  • 1:18
    It gives us the ability to add view modes to blocks.
  • 1:21
    So it gives us all those different advantages,
  • 1:23
    and just like the Context module, the Bean module
  • 1:25
    is stored in code as well.
  • 1:26
    Let's quickly take a look at some of the stuff
  • 1:28
    that the Bean module's doing for us in our demo site.
  • 1:30
    You can see over here, this cute little kitten
  • 1:32
    is a block with an image field.
  • 1:35
    So you are now able to do that without having to do nodes
  • 1:38
    with views or just a bunch of other different types of modules.
  • 1:42
    Let's go ahead and take a look what else we've got.
  • 1:44
    So now it also adds to the UI this Blocks link here in the shortcuts,
  • 1:49
    which if you click on that, we now can see all the blocks
  • 1:52
    that we created with the Bean module.
  • 1:54
    Here's where we can add a block.
  • 1:55
    We can have different types of blocks.
  • 1:57
    So just like content types, we now have block types.
  • 2:00
    So we have in this particular demo site an Image block
  • 2:04
    and a Quote block.
  • 2:05
    So you can start creating as many different types of blocks
  • 2:07
    as you want, just like you do with content types.
  • 2:10
    So this now allows people that are creating content to not just create
  • 2:14
    a generic block and not be able to do much with it besides adding text
  • 2:17
    to it. They can start doing anything that they would normally
  • 2:20
    do with a node, but it is truly a block entity.
  • 2:24
    So we can also look at, under Structure,
  • 2:28
    we also have Block types, and here's where we can create
  • 2:30
    all the different types of block types.
  • 2:32
    We've got Image blocks, we have created a Quote block,
  • 2:34
    and these are all the current, different blocks
  • 2:36
    that we're using on this site.
  • 2:38
    We're also now allowed to manage fields and manage display
  • 2:40
    of those fields on blocks, so basically the Bean module,
  • 2:44
    in a nutshell, turns our block system into a much more robust,
  • 2:50
    usable system by creating content types out of blocks,
  • 2:54
    but they are truly blocks at this particular point.
  • 2:57
    Also in conjunction with Context, we can now move our blocks around,
  • 3:02
    created by the Bean module, to start placing
  • 3:06
    different types of custom blocks.

Overview of the Bean Module


Much like using Context to enhance the core block system, the Bean module takes blocks to a whole new level. The Bean module makes blocks act more like content types.  It allows for different block types and for adding fields to blocks. We are also able to manage the display of a block, which comes in handy with Context. We can have a block look different based on the Context of the block.

Additional resources: