Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Form Factory Kits

No security coverage Under active development 3 sites

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

Ask your assistant about Form Factory Kits

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
5
Tracked since
Feb 2023
Latest release
10 months ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP 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
2.0.0-beta3 Pre-release 9–10 Feb 24, 2023
2.0.0-beta2 Pre-release 9–10 Feb 1, 2023