Overview

Provides a way of having permanent custom content blocks without broken instances if the block does not exist. A new fixed block type acts as a wrapper for the content block. If the custom block disappears, this module will re-create it as a new empty block or with a default content stored in config.

This module solves these typical scenarios:

  • Missing blocks in website staging

    Custom blocks created in your local environment are not ported to other site environments (like test, production ...), as a result any reference (instance) to them will end in a "broken block".

    Fixed blocks are part of the site configuration, so they are promoted in the process of staging. Say good bay to the "This block is broken or missing. You may be missing content or you might need to enable the original module" message.

  • Permanent content blocks

    Custom blocks, as content entities, can be deleted. If so, their instances are lost. Fixed blocks are always present in any layout placement, even if the linked custom block disappears.

Features

  • Missing custom blocks are created automatically when needed, with the default content if present or empty if no default content is set.
  • Do everything just from the UI, no special files or custom modules needed.
  • Default content is stored in site config, just export/import as usual.
  • Restore (reset) the block content to its defaults from the UI.
  • No alterations in the block content entity type.
  • Works with panels and any method of block placement.

New options from v1.1

  • Added non-reusable block content option that hides the regular custom block from the list of available blocks. Configurable per fixed block.
  • Added auto-export feature that provides automatic block content creation on config import if the custom block doesn't exists or its default content has changed. This option is also configurable per fixed block.

Usage

As simple as:

  1. add a fixed block content
    at Structure -> Block layout -> Custom block library -> Fixed blocks
  2. create instances where you need it
    be sure to instance (place) the fixed block, not the regular custom block

Dependencies

  • Obviously, the custom block module (block_content), present in core
  • HAL & serialization modules, both in core, to store the default block content in config

Related modules

Similar modules:

  • Simple Block

    Provides a way for creating static and simple blocks. Only a title and a body allowed, config entities are no "fieldable". Simple blocks are entirely stored in the site configuration, so cannot be managed as content by editors or non-admin users.

  • Custom Markup Block

    A very simple module that provides a block with single text area where you can add custom markup to be rendered. No extra configuration entities, just create the new block with the body content. Blocks are not reusable.

  • Recreate Block Content

    A simpler approach that also solves the broken block content instances. It simply creates a new empty custom block when missing with the same IDs but with no default content.

Recommended modules:

  • Default Content

    Exports any content entity within the website code. Any new installation will start with the exported content.

  • Page Manager

    From module description: "It supports the creation of new pages, and allows placing blocks within that page." So if you need a kind of "fixed pages", this module provides that.

  • Fixed Path Alias

    As custom blocks, path aliases are content. This module provides the same functionality as Fixed Block Content, but for path aliases.

Supporting organizations: 

Project information

Releases