Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Show block on pages of a certain type of content

16/04/2025, by Ivan

!Legacy Drupal 7 code below!

Sometimes you need to display a block only on specific pages of a certain content type. In the standard block visibility settings, you can only configure visibility by path or user role. The following code, entered into the block visibility settings with PHP mode enabled, allows you to choose the content types on which the block will be shown.

<?php
$match = false;
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1);
  $node = node_load(array('nid' => $nid)); 
  $type = $node->type; 
  if (isset($types[$type])) { 
    $match = TRUE;   
  }
} 
if (substr($_SERVER["REQUEST_URI"], 0, 6) == '/page/') {
  $match = TRUE;
} 
if ($_SERVER["REQUEST_URI"] == "/node/add/page") { 
  $match = TRUE;
} 
return $match;
?>

For example, the block will be displayed on pages of the "Page" content type, as well as on the page creation form for that type. The $types variable is an array of machine names of content types,