Drupal is a registered trademark of Dries Buytaert

Overview

The Block Content Type Visibility module enhances Drupal's block visibility system by providing an improved user interface for content type-based visibility conditions. It replaces the confusing "Negate the condition" checkbox with intuitive "Show/Hide" radio buttons, making it easier for site builders to control where blocks appear.

Key Features

  • User-Friendly Interface: Clear "Show for selected content types" or "Hide for selected content types" options replace the technical "negate" checkbox
  • Enhanced Core Functionality: Extends Drupal's native content type visibility condition without replacing it
  • Modern Architecture: Uses OOP Hook classes (Drupal 11.1+) for better maintainability
  • Backward Compatible: Works with both Drupal 10 and Drupal 11
  • Performance Optimized: Properly implements cache contexts for optimal performance
  • Standards Compliant: Follows Drupal coding standards and best practices

Use Cases

  • Display promotional blocks only on Article pages
  • Hide sidebar navigation on Landing Page content types
  • Show related content blocks only for specific content types
  • Control block visibility across different content types without custom code
  • Simplify block configuration for non-technical site builders

How It Works

The module provides a custom condition plugin that extends Drupal core's NodeType condition. When you configure a block's visibility settings:

  1. Navigate to Structure → Block Layout
  2. Configure any block's visibility settings
  3. Under the "Visibility" section, expand Content type
  4. Choose your visibility mode with clear radio buttons:
    • Show for the selected content types - Block appears only on selected content types
    • Hide for the selected content types - Block appears everywhere except selected content types
  5. Select one or more content types
  6. Save the block configuration

Installation

Install as you would normally install a contributed Drupal module. See the Installing Drupal Modules documentation for further information.

Via Composer (recommended)

composer require drupal/block_content_type_visibility
drush en block_content_type_visibility

Manual Installation

  1. Download and extract the module to your /modules/contrib directory
  2. Enable the module at /admin/modules or via Drush: drush en block_content_type_visibility

Why This Module?

While Drupal core provides content type visibility conditions for blocks, the "Negate the condition" checkbox can be confusing for site builders. This module improves the user experience by presenting the same functionality in a more intuitive way, making it immediately clear whether blocks will be shown or hidden for selected content types.

Activity

Total releases
3
First release
Nov 2025
Latest release
3 months ago
Release cadence
2 days
Stability
67% stable

Release Timeline

Releases

Version Type Release date
1.0.1 Stable Dec 1, 2025
1.0.x-dev Dev Dec 1, 2025
1.0.0 Stable Nov 28, 2025