Add fields to a block [D8]

This documentation is written for the 8.x-2.x version of Display Suite.

By following this method the site builder gets a block to place that can have a set of fields as defined by a view mode. The block's display can be templated in twig accordingly, and its theming will reflect any selected layouts in the display suite controls.

Loading an Entityform into a Block

To load an Entityform into a block, there are three ways of accomplishing this:

There is a module for that

Allows to load a specified entity form as a block.
After enabling the module, the entityforms will have an optional checkbox to make them a block.
Entityform block

Leveraging Entity API and Views

It is possible to quite easily do this using views. I got this from https://drupal.org/node/1599352#comment-7040050 , thanks @drupov

block print

<br/>
  $block = module_invoke('module_name', 'block_view', 'block_delta');<br/>
  print $block['content'];<br/>



'module_name' = The machine name of the module (i.e. the module's folder name). This is true for core modules too, so for instance 'search', 'user' and 'comment' would all work here.



Add fields to a block [D7]

This documentation is written for the 7.x-2.x version of Display Suite.

Display Suite allows you to put certain fields inside a region that will be rendered as a block. This can then be managed via the Drupal core block administration.

Controlling Block Display

Author's note: the Context section of this page would benefit from screenshots. During the presentation, I was able to demo the options, but obviously that doesn't work as well with static docs. I'll add them myself in time, unless someone beats me to it. End Note

Blocks and Menus

Every time you create a menu, a corresponding block is created that displays that menu.

You can also create custom blocks at admin/structure/block/add.

Now that we have these blocks, we need to display them.

The two commonly used methods of controlling block display are the core block display functionality, or the contributed Context module. Both means achieve the same goal; the context module provides more flexibility.

Core Block display

The core block visibility settings can be accessed at admin/structure/block.

To display a block in a region, use the drop down menu for the block you want to show:

In addition to setting the region for a block, you can also set additional features by using the "configure" link visible in the above screenshot.

Webform in a block

Webforms can be used in a block. Webform Ajax can be added to update the form in the block without reloading the page.

Pages

Subscribe with RSS Subscribe to RSS - block