---
url: 'https://metadrop.net/en/articles/form-api-drupalcon-prague'
title: 'The form API at the DrupalCon Prague'
author: 'Ricardo Sanz'
date: '2022-09-27T20:18:49+00:00'
updated: '2026-06-04T07:14:56+00:00'
type: article
summary: 'The Form API is a Drupal powerful system to create all kinds of forms. However, given its complexity, it may be hard to completely understand it, and it is easy to end up fighting against it when building complex forms. This article introduces the DrupalCon Prague 2022 "The Form API Workflow API" session that helps to understand this workflow.'
tags:
  - 'Drupal Planet'
  - 'Form API'
  - DrupalCon
published: true
og:
  determiner: Automatic
  site_name: Metadrop
  'image:alt': 'The form API at the DrupalCon Prague'
  street_address: 'Calle Manuel Luna, 12, 3 Dcha'
  locality: Madrid
  region: Madrid
  postal_code: '28020'
  country_name: España
  email: hola@metadrop.net
  phone_number: '910053180'
schema:
  '@context': 'https://schema.org'
  '@graph':
    -
      '@type': Article
      '@id': 'https://metadrop.net/en/articles/form-api-drupalcon-prague#article'
      name: 'The form API at the DrupalCon Prague'
      headline: 'The form API at the DrupalCon Prague'
      description: 'The Form API is a Drupal powerful system to create all kinds of forms. However, given its complexity, it may be hard to completely understand it, and it is easy to end up fighting against it when building complex forms. This article introduces the DrupalCon Prague 2022 "The Form API Workflow API" session that helps to understand this workflow.'
      about:
        - 'Form API'
        - DrupalCon
      datePublished: '2022-10-04T10:30:49+0200'
      dateModified: '2026-06-04T09:14:56+0200'
      author:
        '@type': Person
        name: 'Ricardo Sanz'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
      mainEntityOfPage: 'https://metadrop.net/en/articles/form-api-drupalcon-prague'
    -
      '@type': Organization
      '@id': 'https://metadrop.net/#organization'
      url: 'https://metadrop.net/'
      name: Metadrop
      sameAs:
        - 'https://www.drupal.org/metadrop'
        - 'https://twitter.com/metadrop'
        - 'https://asociaciondrupal.es/partner/metadrop'
        - 'https://www.linkedin.com/company/metadrop'
      logo:
        '@type': ImageObject
        url: 'https://metadrop.net/themes/custom/mdrop_radix/logo-metadrop-500-500.jpg'
        width: '500'
        height: '500'
    -
      '@type': ItemPage
      '@id': 'https://metadrop.net/en/articles/form-api-drupalcon-prague'
      breadcrumb:
        '@type': BreadcrumbList
        itemListElement:
          -
            '@type': ListItem
            position: 1
            name: Home
            item: 'https://metadrop.net/en'
          -
            '@type': ListItem
            position: 2
            name: 'Expert Drupal & Tech Articles'
            item: 'https://metadrop.net/en/articles'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
---
 1. [Articles](https://metadrop.net/en/articles)
 
  

# The form API at the DrupalCon Prague

Tuesday, October 04, 2022

 

 



The Form API is a Drupal powerful system to create all kinds of forms. However, given its complexity, it may be hard to completely understand it, and it is easy to end up fighting against it when building complex forms. This article **introduces the DrupalCon Prague 2022 "The Form API Workflow API" session** that helps to understand this workflow.



   



This year my session on [the Form API workflow was selected for DrupalCon Prague](https://events.drupal.org/prague2022/sessions/form-api-workflow "Session page in the DrupalCon 2022 Prague website"). I was thrilled when I received the message that it had been selected, as to be honest, I have proposed the session at least four times (for Drupal Dev Days and the previous DrupalCons). Ever since I drew [the Drupal 7 Form API workflow illustration](https://www.drupal.org/docs/7/api/form-api/form-api-internal-workflow-illustration#s-drupal-7 "Drupal 7 Form API workflow illustration") years ago, I wanted to create a new one for Drupal 8, but I didn't find the time, so I decided to submit it to a Drupal event. Having a deadline is always a great push to do something.

## The Drupal Form API illustration

 

 

Here you have the [high resolution version](https://metadrop.net/sites/default/files/2022-09/fapi_workflow_complete_v2_md.png "The Drupal Form API Workflow Illustration on high resolution") of the illustration.

A bit complex, isn't it? Don't worry, once you start to familiarize yourself with it, begins to be less overwhelming. So let's start to learn about it.

**First**, let's check the legend. There are **6 different types of rectangular boxes**, each one being a different type of step in the workflow:

- **Entry point**: there is only one entry point and it is where workflow starts. When Drupal needs to process a form it starts here.
- **Core**: those are standard steps of Drupal core. Each box represents an action that Drupal takes on the form, like adding a value, saving to cache, or determining some information about the form.
- **Hooks**: there is only one place where [hooks](https://drupalize.me/tutorial/what-are-hooks "What are hooks?") are called (all form hooks) and is this one. Most form structure and behavior alterations are done in form hooks, although callbacks allow further customization.
- **Callbacks**: these boxes are where Drupal calls a callback, like a validation handler or any other related functions that can be attached to the form at certain points. Those callbacks allow for more customization of the form behavior and structure.
- **Diagram fragment**: each box of this type represents a certain part of the Form API workflow that you can find in another part of the diagram. It is a way to make the diagram less cluttered. When you find one of these boxes just look for the light gray-brown panel with the same name on the bottom-right side.
- **Exit point**: these are the points where the Form API workflow can exit the process.

**Second**, see the diamond-shaped blue elements? Each one is a **decision**, a check Drupal does to decide which path to follow.

Each step is connected by one or more arrows to other steps or decisions, **displaying the different workflow paths**. Together, steps and decisions describe the complete workflow.

A special case are the two ivory panels and the dotted arrows. They **represent recursive calls**. The Form API walks the `$form` array during building and validation and this is the way to express this action in the workflow.

Additionally, the light gray-brown panels are step groups under a name to be **referenced by the diagram fragment boxes** commented above. This way the diagram is easier to read.

Finally, we have the red-dotted boxes. The diagram can still be confusing: the labels of the different steps and decisions are not enough to get all the important information. That is why I added these red-dotted boxes, which are **comments that clarify something relevant** that is not obvious by simply reading the diagram.

The illustration is [also available in Drupal.org](https://www.drupal.org/docs/drupal-apis/form-api/form-api-internal-workflow# "Drupal Form API workflow page"), in the Form API documentation section. 

There is a [repository](https://github.com/Metadrop/drupal-form-api-workflow-diagram "Form API internal workflow diagram repository") open to collaborations with the diagram in different formats, including an editable one.

There is a lot more information in the session slides. In the session, I explain how to create complex webforms by leveraging the Forms API, the details of the different stages of the workflow, and some tips you should know when dealing with forms..

I hope this helps developers to better understand the Form API workflow and ease form development.

The [slides are available at GitHub pages](https://rsanzante.github.io/drupalconprague-2022-form-api-workflow/ "Session's slides").



[Form API](https://metadrop.net/en/articles?text=Form%20API)

[DrupalCon](https://metadrop.net/en/articles?text=DrupalCon)

 

- Ricardo Sanz
    
    CTO
 
[Module development and third-party integrations with Drupal](https://metadrop.net/en/services/drupal/integrations " See Module development and third-party integrations with Drupal")

Metadrop connects Drupal to your CRM, ERP, payment, and marketing stack — Salesforce, Microsoft Dynamics, BBVA virtual POS, Workday, and Keepeek — with custom modules and secure, GDPR-compliant APIs.

 

 See more