Skip to main content
drupalreleases
Release: Cms 2.2.3 — Update released for Drupal core (2.2.3)! Release: Easy Breadcrumb 2.0.11 — Minor update available for module easy_breadcrumb (2.0.11). Release: Bootstrap 8.x-3.42 — Minor update available for theme bootstrap (8.x-3.42). Release: Editoria11y Accessibility Checker 3.0.10 — Minor update available for module editoria11y (3.0.10). Release: Editoria11y Accessibility Checker 2.2.24 — Minor update available for module editoria11y (2.2.24). Release: Leaflet 10.4.13 — Minor update available for module leaflet (10.4.13). Release: Flag 5.1.1 — Minor update available for module flag (5.1.1). Release: MCP Sentinel 2.33.0 — Minor update available for module mcp_sentinel (2.33.0). Module Revived: Bootstrap 8.x-3.41 — Theme bootstrap updated after 6 months of inactivity (8.x-3.41). Security Coverage: Component Library — Module component_library now has official Drupal security advisory coverage.

Block Content Visibility

2 sites Security covered Drupal 10–11
View on drupal.org

This module allows you to set visibility rules directly on reusable custom blocks, so those rules apply everywhere the block is used. It integrates with Drupal's condition system to let you control block visibility based on factors like user roles or page paths, directly from the block's edit form.

Block Content Visibility exposes Drupal core's Condition Plugin System UI directly on the block_content add/edit form. Visibility conditions are stored on the block_content entity and evaluated at render time, so one configuration applies across every placement of that block.

Why

Core stores block visibility on the placement, the block config entity created at /admin/structure/block. That works for a block placed in exactly one region. It stops working when the same reusable block is placed in several regions or themes and the rules should follow the content, when the editors who manage the content have no access to the block layout screen, or when visibility should travel with the content through revisions and translation.

This module adds a third layer, content-level visibility, on a revisionable base field attached to block_content. It is AND-combined with any placement-level conditions, so both layers must pass for the block to render.

Features

  • A Visibility vertical-tabs group on the standard block_content add/edit form, with one tab per Condition plugin available on the site.
  • An explicit "Apply this condition" opt-in per tab, which is what stops a contrib plugin from registering a stored condition merely because its submit handler returned non-default values.
  • Render-time evaluation mirroring core's own BlockAccessControlHandler: per-condition context resolution, a defensive forbid when required context is missing, and full cache-metadata bubbling.
  • A warning on the placement edit form listing the content-level conditions also in play, with a link to edit them, so "why is my block hidden?" has an answer on the screen where it is asked.
  • A settings form to limit which bundles get the UI and to hide Condition plugins from it. Hiding gates the form, never the data: stored conditions for a hidden plugin keep evaluating.
  • No new Condition plugins of its own. The module is plumbing, and its value scales with the plugins already enabled on the site.

Known limitation: Layout Builder

Conditions cannot be set on a Layout Builder inline block. The Visibility UI does not appear in the inline-block dialog, for two reasons that both have to be solved: Layout Builder's form object is not an entity form, which the module's form alter requires, and the form it would attach to is a sub-element, where the entity builder that persists the values never runs.

The evaluation half is in place, so a condition already stored on a block_content revision is honoured for an inline_block plugin. Only the editing half is missing. It is tracked as #3594776. Until it lands, gate Layout Builder blocks with core's placement-level visibility, or make the block reusable and set the condition on the content.

Requirements

  • Drupal 10.3 or newer. Earlier 10.x releases are not supported.
  • PHP 8.2.
  • Block Form Alter 2.x, which provides the form alter hook the module attaches to.

Usage

Open any block content add or edit form, scroll to the Visibility group, open the tab for the condition you want, tick Apply this condition, configure it and save. The condition then applies to every existing and future placement of that block. The permission is administer block content visibility; without it the UI is hidden and stored conditions keep evaluating, so revoking it never silently disables a rule.

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
May 2026
Latest release
1 month ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.0.0 Stable 10–11 Aug 29, 2026
1.0.0-beta1 Pre-release 10–11 May 14, 2026
1.0.x-dev Dev 10–11 May 14, 2026