Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Twig Blocks

Security covered Maintenance fixes only 1,190 sites

Part of the Twig ecosystem · 43 projects

This module allows you to render Drupal blocks directly within your Twig templates using a simple function. You can pass the block's machine name and optionally specify its label and plugin configuration for full control.

Twig Blocks adds a Twig function to render blocks in Twig by passing in the block machine name.

Usage

To render a block, call the function in your Twig template.

The simplest way to render block plugin is as follows.

{{ render_block('block_id') }}

Optionally you can pass block label and plugin configuration in the second
parameter.

{{ render_block('block_id', {label: 'Example'|t, some_setting: 'example', setting_array: {value: value}}) }}

Objective

There is another module that provides similar functionality but it also has an option to turn on and allow PHP execution in the Twig templates which I didn't want to add to my project. This is just a straight-forward function to render a block.

Drupal 8–11

Ask your assistant about Twig Blocks

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Jan 2023
Latest release
7 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core PHP Release date
8.x-2.6 Stable 8–11 Feb 18, 2026
8.x-2.5 Stable 8–10 Jan 25, 2023