Skip to content

Provides examples demonstrating the implementation of Drupal 9/10 custom blocks.

Notifications You must be signed in to change notification settings

sujanshresthanet/Drupal-Custom-Blocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Drupal 9/10 Custom Blocks

This module provides various examples of custom blocks in Drupal 9/10 and demonstrations related to creating custom blocks. Custom blocks are a powerful feature in Drupal that allows developers to create reusable pieces of content or functionality that can be placed within regions of a site's layout. With a variety of examples covering different scenarios and implementations, this module aims to empower developers to create powerful and flexible block-based solutions for their Drupal projects.

Features

  • Basic Custom Block: Learn how to create a simple custom block programmatically.
  • Configuration Form Block: Explore creating custom blocks with configuration forms to allow users to customize block content.
  • Block Plugins: Understand the concept of block plugins and how to create reusable block components.
  • Dynamic Block Content: Implement blocks with dynamic content based on various factors like user roles, permissions, or other contextual information.
  • Custom Block Templates: Customize the display of blocks by using custom block templates.
  • Access Control: Learn how to manage access control for custom blocks based on user roles or permissions.
  • Block Visibility Settings: Explore different ways to configure block visibility settings to control where and when blocks appear.
  • Integration with other Modules: See examples of integrating custom blocks with other Drupal modules, such as Views or Paragraphs.
  • REST API Integration: Understand how to expose custom block content through Drupal's REST API.

Installation

  1. Clone this repository into your Drupal modules/custom directory:

  2. Enable the "Custom Blocks" module either via the Drupal admin interface or using Drush:

  3. Navigate to admin/modules and ensure that the module is enabled.

Usage

  1. Navigate to the Drupal admin interface and go to Structure > Block layout.
  2. Click on the "Custom blocks" tab to view and manage your custom blocks.
  3. Use the examples provided in this module to create, edit, and manage custom blocks as needed.

Contributing

Contributions are welcome! If you have any improvements, bug fixes, or new features and examples to add, feel free to open a pull request.

License

This project is licensed under the GNU General Public License v2.0.