Embed CiviCRM Form Builder forms and SearchKit displays anywhere on your Drupal site. This module provides a "CiviCRM Form Builder block" block type, so any Afform you build in CiviCRM (a submission form, a search form, a dashboard of SearchKit displays) can be placed like any other Drupal block.

Features

  • Place any Form Builder form (Afform) in a theme region from the Block layout page.
  • Add forms to Layout Builder layouts as inline blocks.
  • Reference forms from content with the Block Field module.
  • Loads the CiviCRM and AngularJS resources for you, only on pages where a form block is displayed.
  • Several form blocks can be shown on the same page.
  • Output is rendered through a Twig template (afform-block.html.twig) that themes can override.

New to Form Builder? See the Form Builder documentation.

Requirements

  • CiviCRM with the Form Builder (Afform) extension enabled
  • 1.1.x: Drupal 11.4 or later, or Drupal 12
  • 1.0.x: earlier versions of Drupal

Installation

composer require drupal/civicrm_form_builder_blocks

Then enable the module as usual. There is nothing to configure.

Usage

Block layout

  1. Go to Structure → Block layout.
  2. Click "Place block" for a region.
  3. Find "CiviCRM Form Builder block" and click "Place block".
  4. Choose the form to embed from the "Form Name" list.
  5. Set visibility as needed and save.

Layout Builder

Add a block to a section and choose "CiviCRM Form Builder block", then select the form.

Block Field

Add a Block Field field to an entity type and select "CiviCRM Form Builder block" when editing content.

Good to know

  • The form's title is displayed above the form, as set in Form Builder.
  • Afforms of type "block" (reusable fragments meant to be embedded in other forms) are not offered in the list.
  • Form blocks are not cached, because the form's resources are loaded per request.

Development

Maintained by Mark Hanna at Skvare, supporting and developing Drupal and CiviCRM since 2008.

Like this but need it to do more? Contact Skvare to contract development from our professional CiviCRM and Drupal developers.

Supporting organizations: 

Project information

Releases