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). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). 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). 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.

Form Factory Kits

2 sites No security coverage
View on drupal.org

This module provides tools to quickly generate Drupal forms by creating reusable form component kits. These kits can be assembled using a fluent API to build complex forms, such as those with vertical tabs, and are compatible with the FormFactory module.

Make custom Drupal forms... faster.

This module provides a service capable of creating FormFactoryKit objects.

Each kit is able to generate an array compatible with Drupal's Render API.

When appended to a FormFactory instance (provided by formfactory module), the kit is used to help create a complete form.

The kits provided by this module are merely covering Form API basics. Collections of Kit objects can be provided by any module.

Example

  public function buildFormObject(FormFactoryInterface $form_factory, FormFactoryKitsInterface $kits): void
  {
    // Optional: the Form State object can be accessed via the Form Factory.
    $form_state = $form_factory->getFormState();

    // Create VerticalTabsKit & add it to the FormFactory instance.
    $tabs = $kits->verticalTabs();
    $form_factory->append($tabs);

    // Create a "dogs" TabKit & add it to the VerticalTabsKit instance.
    $dogsTab = $tabs->createTab('dogs')
      ->setTitle($this->t('Dogs'));
    $dogsTab->append(
      $kits->image('dogs_image')
        ->setTitle($this->t('Image'))
    );
    $dogsTab->append(
      $kits->textarea('dogs_description')
        ->setTitle($this->t('Description'))
    );
    $dogsTab->append(
      $kits->checkboxes('dogs_attributes')
        ->setTitle($this->t('Attributes'))
        ->appendOption(['a' => $this->t('A')])
        ->appendOption(['b' => $this->t('B')])
        ->appendOption(['c' => $this->t('C')])
        ->setDefaultValue(['b'])
    );

    // Create a "cats" TabKit & add it to the VerticalTabsKit instance.
    $tabs->createTab('cats')
      ->setTitle($this->t('Cats'))
      ->append($kits->image('cats_image')->setTitle($this->t('Image')))
      ->append($kits->textarea('cats_description')->setTitle($this->t('Description')));

    // Create a SubmitKit & add it to the FormFactory instance.
    $form_factory->append($kits->submit());
  }

Documentation

Activity

Total releases
3
First release
Nov 2025
Latest release
7 months ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Slowing

Release Timeline

Releases

Version Type Release date
2.1.0-beta1 Pre-release Dec 13, 2025
2.0.0-beta5 Pre-release Nov 22, 2025
2.0.0-beta4 Pre-release Nov 22, 2025