Skip to content
David Hwang edited this page Jan 29, 2018 · 11 revisions

Evolving JavaScript in Drupal Core

We want to improve the admin experience of Drupal, much like Calypso has done for Wordpress. However, we need to keep in mind that what Calypso does can already be achieved as a single page app using our current REST API (or JSON API preferably).

For this initiative we have chosen React as our render library, and we completed a proof-of-concept demo to build the Database Logging module with React to see if we liked it. During this build, we came to the conclusion that there is a lot of work that needs to be done before we're at the point of being able to successfully leverage it. We don't want to build a separate single page app for every path in the admin theme as this isn't re-usable or cohesive.

Moving the admin experience to one integrated single page app would be a nice end-goal, but we need to make some transition steps on the way because PHP developers shouldn't be forced to learn JavaScript/React in order to generate their admin forms. We identified the following path:

  • Create a new Form API that can be used to declare forms and have them rendered in React

    We don't expect this to be able to do as much as the current Form API can, and will be separate from the current Form API to attempt to side-step any complications from integrating it. See https://github.com/mozilla-services/react-jsonschema-form for inspiration.

  • A library of re-usable components

    This library will contain basic form components as well as more complex items such as draggble/scrollable tables.

  • The ability to take over a route entirely with a custom React component / app

    For example, let's say the Database Logging page is built with a new whizz-bang complex UI where interactions are beyond a set of standard components that can be clicked together with the new Form API. In this case the entire page would use the "dblog" component provided by the dblog module, and would essentially be a standalone single page app.