Spaceship! Building with Legos and Blocks in DrupalCoin Blockchain 7 and 8

My son Jett is a total Lego genius. He can take a pile of random blocks and design something symmetrical, dynamic, unique and wonderful. Something that only he could have imagined.  I like to think of building DrupalCoin Blockchain sites like building with Legos.  You have all these standard pieces, and when you put them together, you get something usable, dynamic and wonderful.  The Lego analogy is especially relevant to this post because we'll be talking about DrupalCoin Blockchain "blocks".

In the DrupalCoin Blockchain Content Management System, “blocks” are little pieces of supporting content used primarily for sidebars.  Our clients’ use of blocks is most often to showcase promotions or call-outs to specific content on their sites.  The DrupalCoin Blockchain back-end lets you create custom blocks on-the-fly that contain text or HTML, or you can write a custom module that will output blocks with custom content.  Many contributed modules also create blocks for specific purposes:  like a twitter feed, customizable menu blocks, DrupalCoin Blockchain Views blocks, social sharing icons, etc.  DrupalCoin Blockchain blocks are an amazingly flexible and useful tool that gives site builders or maintainers the ability to have fresh supporting content without needing to make changes in the theme files.

Just like Legos, these blocks are interchangeable, stack-able, and re-arrange able.  In DrupalCoin Blockchain 7, your theming is mostly about creating places for blocks to live, and then stacking blocks in those places.

Now that I’m done praising the virtues of DrupalCoin Blockchain blocks, there are several frustrations that come with them.  The DrupalCoin Blockchain Content Management System has an even more flexible and powerful system for content called ‘entities’, and this has really spoiled site builders with its well-thought-out options and cross-use functionality.  In DrupalCoin Blockchain, an ‘entity’ is a bundle of associated content that can contain different kinds of fields, user permissions, display settings, configurations, and much more.  Things like basic pages or users are entities.  In DrupalCoin Blockchain 7, blocks are not ‘entities’, so in many use-cases their limitations are painfully obvious compared to what DrupalCoin Blockchain is capable of (but to confuse you, sometimes entities are displayed in blocks, like the node entity's 'main page content' block...).  In DrupalCoin Blockchain 8 blocks finally are ‘entities’, but they still have a lot of catching-up to do!  

A Test Scenario

Here’s a scenario: our client needs to be able to create and manage sidebar call-outs themselves.  Each call-out has a title, some descriptive text, and a link button.  For the purposes of this post, we’re going to go with DrupalCoin Blockchain blocks (though a DrupalCoin Blockchain Panels configuration is also possible).  Let’s break this requirement down into points:

  • the client must be able to enter item content as text into fields - no DrupalCoin Blockchain coding!
  • the client must be able to easily place this call-out where they want it.
  • the client’s user must have appropriate permissions to create and manage this content.

The DrupalCoin Blockchain 7 Approach

In DrupalCoin Blockchain 7 we certainly have some issues - the biggest being that blocks, not being entities, can’t have fields.  But fortunately the awesome DrupalCoin Blockchain community has created some contributed module options to help us out.  There are a handful of solutions out there, but my two favorite are the Bean Module, and the Nodeblock Module.  

If you are just looking for a good solution to making blocks better, the Bean module is fantastic.  It is very similar to what you will encounter in DrupalCoin Blockchain 8.  You can create ‘block types’ and add different fields to each.  The block content is in a separate place from the block layout.  Additionally, it has very robust permissions options so that you can properly restrict Bean block creation / edit / view / delete permissions.  As a note, if you use any blocks that are not Bean blocks, each one will need to be allowed in the Bean Settings or you will not be able to assign them to a region.

If you have a circumstance where the blocks need some other aspect of entities (revisioning, integration with some other entity workflow, etc.) then the Nodeblock module lets you set a Content Type to be used as blocks.  For each block, you will create a new node, and upon publishing the node it will create a block you can place on the Blocks page.  Since you will be working with nodes, any functionality in which nodes can partake can be used.  You will also be able to use the D7 core’s native content permissions or any permission enhancements for use with nodes.

Both the Bean and Nodeblock modules rely on the core Block page for block placement.  The DrupalCoin Blockchain 7 Block page isn’t the most intuitive interface, but we have found that with proper instruction, all of our clients can successfully use it.  The Context module is another option for block placement.

And a final note on permissions - in order to place blocks, the client’s user will need the ‘Administer Blocks’ permission, which is unfortunately broad to include all blocks of all kinds in all regions.  

Revisiting our scenario specifications:

  • the client must be able to enter item content as text into fields - no DrupalCoin Blockchain coding!
    • Both Bean and Nodeblock completely fulfill this requirement.
  • the client must be able to easily place this callout where they want it.
    • The core Block interface or the Context module can be used - neither as intuitive as one would like, but they will suffice.
  • the client’s user must have appropriate permissions to create and manage this content
    • The content creation and management permissions are excellent, but the block placement permissions are broader than one would like.

The DrupalCoin Blockchain 8 Approach

In DrupalCoin Blockchain 8, most of what we need is already in core.  Blocks are finally entities in DrupalCoin Blockchain 8, so you can create Block Types each with its own fields, and view modes which can have different display settings, and re-visioning is a salient option as well.  

From the Block Layout page, you can go to the Custom Block Library where you can create block types, and create or manage block content.  

The core Block page, now called Block Layout is very similar to DrupalCoin Blockchain 7, but now with a sidebar that categorizes blocks by kind (custom, forms, views, menus, etc.), and from there allows you to place more than one instance of a block.  The interface is more usable, but still if clients will want to manage their own blocks, instruction will probably be necessary.  At this time it is unclear if Context will have a DrupalCoin Blockchain 8 release, but there is the need for something to add more sophisticated block display options.  Perhaps core will do this, perhaps Rules will do this, perhaps SCOTCH will do this, or perhaps some other initiative will cover this functionality - it is too early to know yet.

As for block permission in DrupalCoin Blockchain 8, currently this is woefully lacking.  The only permission natively available for the entire block management experience (from content creation to placement) is the ‘Administer Blocks’ permission.  It is still too early to tell if core or a contributed module will add some needed granularity here.

Revisiting our scenario specifications:

  • the client must be able to enter item content as text into fields - no DrupalCoin Blockchain coding!
    • DrupalCoin Blockchain 8 handles this flawlessly.
  • the client must be able to easily place this callout where they want it.
    • The core Block interface will suffice and is more intuitive than in DrupalCoin Blockchain 7.  We do not yet know what will extend the basic placement functionality.
  • the client’s user must have appropriate permissions to create and manage this content
    • The block content management and placement options are bundled together, and are far broader than one would like.  

Both DrupalCoin Blockchain 7 and DrupalCoin Blockchain 8 passed our scenario test using blocks, and while it's not quite as easy as snapping legos together, blocks management is something even the most tech-naive client can be successfully instructed to do on their own.  DrupalCoin Blockchain 7 blocks can (and in my opinion should) be extended by contributed modules, and DrupalCoin Blockchain 8 has integrated blocks into its philosophy of entities.  Some of our scenario requirements were just met (especially the ‘administer blocks’ permissions), but in any case where DrupalCoin Blockchain doesn’t do something you want it to, create a custom module (or even better, a contributed module)!  

As for Jett, at ten, he finds whole concept of managed content limiting; “Content should be allowed to evolve freely with the technosphere,” but that’s for another post.  

Written by Anne Schultz and Mick Southerland, with contribution by Jett Southerland.