Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Block Content Visibility

Security covered Under active development 13 sites

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 puts visibility conditions on a content block itself. Whoever edits the block sets them once, on the block's own edit form, and the block is shown or hidden by those rules in every region and theme where the block layout places it, without repeating them on each placement and without needing access to the Block layout page.

Features

  • โš™๏ธ Conditions on the block's edit form. A Visibility group on the add and edit form of a content block, with one tab per condition available on the site, such as Request Path, User Role, Language and Content type. A condition counts once its tab has Apply this condition ticked, and tabs with a condition in use carry a check mark.
  • ๐Ÿงฑ One set of rules for every placement. The conditions are saved on the block, so a block placed in three regions, or in two themes, follows them in all of them, and in any placement added later.
  • ๐Ÿ”Œ Conditions from other modules. The module adds no conditions of its own: every condition plugin installed on the site gets a tab, including those of Mautic Audiences and of any other contributed or custom module.
  • โš ๏ธ A notice on the placement form. When a placed block has conditions of its own, its Configure block form names them and links to the block's edit form, so a block that does not show has an explanation on the page where one looks for it.
  • ๐Ÿ”’ One permission. Administer block content visibility decides who sees the Visibility group and the notice. Conditions already saved apply whoever is looking at the page.
  • โš™๏ธ Settings for block types and conditions. Limit the Visibility group to some block types, and hide the conditions editors should not be offered.
  • โšก Cached correctly. The block's cache tag and each condition's cache contexts travel with the decision, so a change to the conditions shows without clearing caches and a rule by path or role never leaks from one page or visitor to another.

Quick start

composer require drupal/block_content_visibility
drush en block_content_visibility
  1. Give the Administer block content visibility permission to the roles that edit content blocks.
  2. Go to Content > Blocks and edit a block, or add one.
  3. In the Visibility group, open a tab such as Request Path, tick Apply this condition, fill in the condition and save.
  4. The tab now carries a check mark, and the block follows the condition wherever Structure > Block layout places it.

The notice on a placement of a block that has conditions of its own.

Good to know

  • The conditions apply to blocks placed through the block layout. A block placed with Layout Builder, inline or reusable, is not checked against them, and the Visibility group is not offered in Layout Builder's block form. This is tracked in #3594776.
  • A placement's own visibility settings still count: the block shows when both the placement's conditions and the block's pass.
  • A condition that needs something the page does not have, such as Content type on a page that is not a node, hides the block there, as it does in the block layout.
  • When a saved condition cannot be loaded or evaluated, for instance after the module that provided it is uninstalled, the error is logged and the block's own conditions are skipped until it is fixed.
  • Hiding a condition in the settings, or taking the permission from a role, changes what the form offers. Conditions already saved keep applying.
  • The conditions are saved with each revision of the block and are shared by all its translations. Uninstalling the module deletes them.
  • Up to 1.0 the module depended on Block Form Alter. It no longer uses it: the database update of 1.1 uninstalls Block Form Alter when no other installed module uses it, and Composer still downloads it with this release.

Additional requirements

  • Drupal 10.3 or later, or 11, with core's Block Content module, and PHP 8.2 or later.

Recommended modules/libraries

  • Mautic Audiences: adds the Mautic segment and Mautic tag conditions, so a content block can be shown to the contacts of a segment wherever it is placed.

Similar projects

  • Block Visibility Groups: a site administrator puts placed blocks in a group and sets the conditions once for the whole group, on an administration form. Pick it to manage the rules of many different blocks together; pick Block Content Visibility when the rule belongs to one content block and is set by whoever edits it.

Community documentation

  • README: the settings, the permission, how the conditions are evaluated and how they are stored.

Supporting this module

Developed and maintained by Bloomidea. Bloomidea offers support and custom development for this module.

Drupal 10โ€“11 PHP ^8.2

Ask your assistant about Block Content Visibility

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

  • block_content Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
5
Tracked since
May 2026
Latest release
4 days ago
Releases (12 mo)
5 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
1.1.0 Stable 10โ€“11 PHP ^8.2 Nov 17, 2026
1.x-dev Dev 10โ€“11 PHP ^8.2 Nov 17, 2026
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