Layout Builder’s missing piece: JS defined blocks

Drupal Camp Asheville 2024 - July 12th-14th

Room
Beaucatcher Mountain (225)
Start Time

Topics

Presenter(s)

Kyle Einecker
of
Perficient
Session title slide with Kyles standing in front of a lake

Adding new block types to Layout Builder is hard… harder than it should be. You either have to deal with Custom Block types which have a fairly rigid field structure that lack composability and are tracked as config. Or there’s Inline Blocks which require creating a new Block plugin PHP class and understanding how to create a form using Form API. Neither option is particularly attractive to a Front End developer who just wants to build the next component for a site.

But what if adding a new block type for Layout Builder didn’t require knowing about fields, or config, or plugins, or Form API, or even PHP? What if a Front End developer could define the entirety of a block's data structure using JSON Schema and have it just automatically appear in Layout Builder? This what if could be a reality by stringing together a few contrib modules.

In this session, we’ll look at how combining RJSF, Components, and block plugin derivers can be used to create a FED friendly component system for Layout Builder that requires shockingly little knowledge of Drupal.