Move preprocess functions to JS code

Created on 10 October 2023, 11 months ago
Updated 30 November 2023, 9 months ago

Problem/Motivation

A lot of what is typically in a theme's preprocess functions is front-end logic. Therefore, it belongs near the JSX code, either inside the JSX component or as a helper function called by it. It would be good for the Umami JSX theme to demonstrate the ability to do this.

Some preprocess functions currently within umami_jsx.theme can't be easily moved yet:

  • umami_jsx_preprocess_html(), because the 'html' template is still in Twig and might need to stay that way, at least for now, and maybe even permanently.
  • umami_jsx_preprocess_breadcrumb(), because that accesses information that's not in the $variables array, and the JSX theme engine doesn't yet have a way to do that.

But all the other preprocess functions should be moveable to JS.

Steps to reproduce

Proposed resolution

For the preprocess functions in umami_jsx.theme other than umami_jsx_preprocess_html() and umami_jsx_preprocess_breadcrumb(), convert the corresponding components from Twig to JSX and move the logic that's in the preprocess functions into the JSX component or a helper library.

If some of these are tricky, one MR for the easy ones and separate child issues for the hard ones would be totally fine.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Fixed

Version

1.0

Component

Umami JSX Demonstration Theme

Created by

πŸ‡ΊπŸ‡ΈUnited States effulgentsia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024