SDC & Form API, better late than never

Speaker(s)

Grimreaper

Duration

30 min

Session track

Frontend & Design

Experience level

Intermediate

Description

Since summer 2023, Drupal Core has an API for UI components: SDC. This API is beloved by the community and enjoys a growing ecosystem of modules (SDC Display, UI Patterns, Experience Builder…) and themes. This is a strategic move for Drupal Core toward a "design system” oriented theming.

However, there is a forgotten part, a big one. In a design system, a lot of components (around 20%) are form elements: checkboxes, date pickers, switches, sliders, input groups… but SDC doesn’t allow to implement such form elements.

First, because the SDC render element doesn't play nice with the rigid Form API. Second, because SDC components are stateless so don’t hold the form data.

Considering that, a front-end developer working with Drupal today has 2 different experiences: nice, friendly & efficient for “normal” components with SDC. Messy, complicated & risky for form components with some PHP hooks and overlapping templates overrides.

We will show how to fix that, by following 2 Drupal Core issues, diving into the internals of the Drupal rendering pipeline and discovering one of the next big modernizations of the Drupal theming.