Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module provides special form fields for embedding plugin configurations within Drupal forms. It allows you to include a form for a single pre-selected plugin or a more dynamic interface where users can add, configure, and manage multiple plugins.

Plugin form element provides two Form API elements — plugin and plugins — that let developers embed plugin configuration forms directly inside any Drupal form.

The plugin element renders the configuration form for a single pre-selected plugin (e.g. one condition, one action). The plugins element provides a full multi-item UI backed by vertical tabs, where users can add, configure, and remove multiple plugins from any plugin manager — with optional cardinality limits and allowlists.

Features

  • #type => 'plugin' — renders the configuration form for a single plugin instance
  • #type => 'plugins' — multi-item UI with vertical tabs, AJAX add/remove, and form submission handling
  • Works with any plugin manager implementing PluginManagerInterface
  • Supports FilteredPluginManagerInterface for context-aware plugin filtering
  • #cardinality property to limit how many plugins can be added
  • #allowed_plugins property to restrict which plugins appear in the Add menu
  • Full compatibility with PluginFormInterface and PluginWithFormsInterface

Usage

Configure a single plugin whose ID you already know:

$form['condition'] = [
  '#type' => 'plugin',
  '#title' => $this->t('Condition'),
  '#plugin_manager' => 'plugin.manager.condition',
  '#default_value' => [
    'id' => 'language',
    'langcodes' => ['en' => 'en'],
  ],
];

Let users pick and configure multiple plugins from any manager:

$form['conditions'] = [
  '#type' => 'plugins',
  '#title' => $this->t('Conditions'),
  '#plugin_manager' => 'plugin.manager.condition',
  '#cardinality' => -1,              // -1 = unlimited
  '#allowed_plugins' => ['language', 'request_path'], // optional allowlist
  '#default_value' => $saved_config, // keyed by UUID
];

On submit, $form_state->getValue('conditions') returns a UUID-keyed array of plugin configurations — ready to store and reinstantiate.

Activity

Total releases
1
First release
Feb 2026
Latest release
5 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.0-rc4 Pre-release Feb 2, 2026