Block

Last updated on
30 April 2025

Features

  • Create / Modify / Delete custom blocks
  • Modify module-provided blocks
  • Can modify the weight of blocks.
  • Can work with multiple themes

Available Tags

  • block
  • block_role
  • block_node_type

Automatic extraction of patterns files status

Yes, supported in versions >= 7.x-2.x

Examples (for Patterns >= 7.x-2.x)

Block Tag: create a custom block

# YAML Block Pattern
# QScience
# This pattern has been automatically generated at Patterns->Export

info:
  title: Blocks (create)
  description: Inserts a custom block in the sidebar of Bartik in the main page
  author: QScience
  category: Block
  version: 1.0
  core: 7.x
  author_website: http://qlectives.eu/
modules:
  - block
block:
  - 
    create:
      tag: block
      module: block
      body: This is a block created from an automatically exported pattern!.
      info: Automatic Pattern Block
      format: filtered_html
      theme: bartik
      status: 1
      weight: 0
      region: sidebar_first
      custom: 0
      visibility: 1
      pages: '<front>'
      title: block_title_test_manual_opt_pattern
      cache: -1

Block Tag: modify settings of module-provided and a custom blocks

# YAML Block Pattern
# QScience
# This pattern has been automatically generated at Patterns->Export

info:
  title: Blocks (modify)
  description: Modifies a module-provided and a custom block.
  author: QScience
  category: Block
  version: 1.0
  core: 7.x
  author_website: http://qlectives.eu/

modules:
  - block
block:
# Modify common settings of a normal and a custom block for the theme 'seven'
  - 
    modify:
      tag: block
      module: user
      delta: online
      theme: seven
      status: 0
      weight: 0
      region: dashboard_inactive
      custom: 0
      visibility: 0
      pages:
      title:
      cache: -1
  - 
    modify:
      tag: block
      module: block
      delta: 1
      theme: seven
      status: 1
      weight: 0
      region: -1
      custom: 0
      visibility: 0
      pages:
      title: new_title
      cache: -1

Block Tag: delete a custom block

# YAML Block custom delete Pattern
# QScience

info:
  title: Blocks (custom) delete
  description: Deletes a custom block.
  author: QScience
  category: Block
  version: 1.0
  core: 7.x
  author_website: http://qlectives.eu/

actions:
  - delete:
     tag: block
     module: block
     delta: 1

Block Role Tag: makes a block visible for certain role

# YAML Block Pattern
# QScience
# This pattern has been automatically generated at Patterns->Export

info:
  title: Blocks and Roles (create)
  description: Makes search block visible for the role administrator
  author: QScience
  category: Block
  version: 1.0
  core: 7.x
  author_website: http://qlectives.eu/
modules:
  - block
block_role:
  - 
    create:
      tag: block_role
      module: search
      delta: form
      role: administrator

Block Role Tag: makes a block not visible for certain role

# YAML Block Pattern
# QScience

info:
  title: Blocks and Roles (delete)
  description: Makes search block not visible for the role administrator
  author: QScience
  category: Block
  version: 1.0
  core: 7.x
  author_website: http://qlectives.eu/
modules:
  - block
block_role:
  - 
    delete:
      tag: block_role
      module: search
      delta: form
      role: administrator

Block Node Type Tag: makes a block visible for certain content type

# YAML Block Pattern
# QScience
# This pattern has been automatically generated at Patterns->Export

info:
  title: Blocks and Node types (create)
  description: Makes search block visible for the content type page
  author: QScience
  category: Block
  version: 1.0
  core: 7.x
  author_website: http://qlectives.eu/
modules:
  - block
block_node_type:
  - 
    create:
      tag: block_node_type
      module: search
      delta: form
      type: page

Block Node Type Tag: makes a block not visible for certain content type

# YAML Block Pattern
# QScience

info:
  title: Blocks and Node types (delete)
  description: Makes search block not visible for the content type page
  author: QScience
  category: Block
  version: 1.0
  core: 7.x
  author_website: http://qlectives.eu/
modules:
  - block
block_node_type:
  - 
    delete:
      tag: block_node_type
      module: search
      delta: form
      type: page

Help improve this page

Page status: Not set

You can: