Release Day: Drupal 8 Form API

Module Development Guide

Introduced way back in Drupal 4.7 and evolving ever since, the Form API is essential for any module developer to master. Forms are one of the primary means through which users interact with a web application. And the Form API is how Drupal module developers create, update, and modify forms.

For many developers implementations of hook_form_api() are the first foray into writing custom modules. No matter where you are on your journey to mastering Drupal module development you'll benefit from understanding the ins-and-outs of the Form API.

In this first set of tutorials on the Form API, we'll talk about what exactly the Form API is and the benefits it has over hard-coded HTML forms, including a detailed look at the life cycle of a form and the various points at which developers can jump in and customize things. We'll discuss the overlap between the Form API and the Render API, look at how to map a route to a form controller, and how form controllers can build, validate, and process submitted data for, forms.

We'll also look at the venerable hook_form_api(), how to implement it, and some examples of not changing how forms look but also how they are validated and processed.

Here's the full list of tutorials we're releasing today:

In the future, we'll be adding additional tutorials on:

  • Submitting forms via AJAX
  • Handling file uploads
  • and, creating multi-step wizards with the Form API

Let us know if you've got any burning questions about Drupal's Form API.

Comments

Add new comment