Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Block Layout Accordion 1.0.2 Minor update available for module block_layout_accordion (1.0.2). Release: Canvas interactive toggle 1.0.2 Minor update available for module canvas_interactive_toggle (1.0.2). Release: Views HTTP Client 1.0.2 Minor update available for module views_http_client (1.0.2). Release: Block Layout Accordion 1.0.1 Minor update available for module block_layout_accordion (1.0.1). Release: Canvas interactive toggle 1.0.1 Minor update available for module canvas_interactive_toggle (1.0.1). Release: Video.js (HTML5 Video Player) 10.0.0-alpha1 First alpha version released for module videojs (10.0.0-alpha1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Release: Audit Trail 1.0.0-alpha7 New alpha version released for module audit_trail (1.0.0-alpha7). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Twig Blocks

880 sites Security covered Drupal 8–11 Twig ecosystem
View on drupal.org

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.

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
1
Tracked since
Feb 2026
Latest release
6 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core Release date
8.x-2.6 Stable 8–11 Feb 18, 2026