Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

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

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Nov 2025
Latest release
8 months ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Slowing

Release Timeline

Releases

Version Type Core Release date
2.1.0-beta1 Pre-release 10–11 Dec 13, 2025
2.0.0-beta5 Pre-release 10–11 Nov 22, 2025
2.0.0-beta4 Pre-release 9–11 Nov 22, 2025