Simple Block
Provides custom blocks stored as config entities instead of content entities, making them easily deployable through configuration management.
simple_block
Install
composer require 'drupal/simple_block:8.x-1.7'
composer require 'drupal/simple_block:8.x-1.4'
Overview
Simple Block provides a block plugin that creates blocks based on configuration entities. Unlike the core Block Content (block_content) module which stores blocks as content entities in the database, Simple Block stores blocks as config entities. This architecture provides significant advantages when you need to deploy blocks using Drupal's configuration management system.
Each simple block is identified by a unique machine name string and contains only a title and a formatted text area. The blocks support global token replacement, allowing dynamic content insertion. Once created, simple blocks can be exported as YAML files to your config sync directory and deployed as configuration to other environments, making them ideal for development workflows that rely on configuration synchronization.
The module also provides a Layout Builder integration submodule that allows simple blocks to be created and edited directly within the Layout Builder interface.
Features
- Store custom blocks as configuration entities instead of content entities for easy deployment via config management
- Create blocks with a title and formatted text content using any available text format
- Support for global token replacement in block content (e.g., [site:name])
- Clone existing blocks to quickly create similar blocks with new machine names
- Contextual links for quick editing of blocks on the frontend
- Field formatter to display simple blocks through entity reference fields
- Layout Builder integration via optional submodule for creating and editing blocks directly in Layout Builder UI
- Blocks are automatically available as block plugins in the Block Layout interface
Use Cases
Deploying site-wide notices across environments
Create a simple block for site-wide announcements or notices that need to be consistent across development, staging, and production environments. The block can be exported as configuration and deployed through your normal deployment pipeline, ensuring the same content appears on all environments.
Footer or header content blocks
Create simple blocks for footer content like copyright notices, contact information, or header banners. These can include tokens like [current-date:custom:Y] for the current year, which updates automatically.
Reusable content snippets for Layout Builder
With the Layout Builder submodule enabled, content editors can create reusable simple blocks directly while building layouts. This is useful for content that should appear in multiple places or across multiple content types.
Configuration-based promotional blocks
Create promotional blocks or call-to-action blocks that can be version controlled and reviewed through code review processes before deployment, unlike content-based blocks which are stored in the database.
Tips
- Use meaningful machine names for your simple blocks since they cannot be changed after creation
- Take advantage of token replacement for dynamic content like site name or current date
- Export simple blocks as configuration before deployment to ensure consistency across environments
- The Clone feature is useful for creating variations of existing blocks with similar content
- Simple blocks are ideal for content that needs to be version controlled and deployed via CI/CD pipelines
Technical Details
Admin Pages 5
/admin/structure/block/simple-block
Lists all simple blocks created on the site. From this page you can view, edit, clone, and delete existing simple blocks, as well as add new ones.
/admin/structure/block/simple-block/add
Create a new simple block with a unique machine name, title, and formatted content.
/admin/structure/block/simple-block/manage/{simple_block}/edit
Modify an existing simple block's title and content. The machine name cannot be changed after creation.
/admin/structure/block/simple-block/manage/{simple_block}/clone
Create a copy of an existing simple block with a new machine name. The title and content are pre-populated from the source block.
/admin/structure/block/simple-block/manage/{simple_block}/delete
Confirmation page for deleting a simple block. This action cannot be undone.
Permissions 4
Troubleshooting 3
This occurs when a block plugin references a simple block entity that has been deleted. Either recreate the simple block with the same ID, or remove the block from the block layout configuration.
Clear the cache after making changes. Simple blocks invalidate the block plugin cache on save, but you may need to clear caches manually in some scenarios.
Ensure the Simple Block + Layout Builder submodule is enabled. The inline editing functionality requires this submodule to be active.
Security Notes 3
- Simple blocks respect text format permissions - users can only select text formats they have access to
- The content is rendered using processed_text, which applies the security filters of the selected text format
- Users need the 'administer blocks' permission or specific simple block permissions to manage blocks