Fixed block content

Component ID

2919542

Component name

Fixed block content

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

355

Component created

Component changed

Component body

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 ends in a "broken block".

    Fixed content 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 will be lost. A fixed block content is always present in any layout placement, even if the linked custom block disappears.

Features

  • Missing custom blocks are created automatically when needed, with their default content if present or empty if no default content is set.
  • Set the default content 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 alteration over the block content entity type.

Usage

As simple as:

  • add a fixed block content
  • create instances where you need it

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.

  • 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.