Claro status-message example

Created on 17 January 2023, about 2 years ago
Updated 16 March 2023, almost 2 years ago

I have implemented an example of usage replacing the status-messages template used by the admin themes. In this case I have created a replica of the Claro version of it but inside a SDC in a custom module.

Summarizing, what I did is:

- Create a custom SDC replicating the logic existing in the core/themes/claro/templates/misc/status-messages.html.twig and copying the CSS from core/themes/claro/css/components/messages.css
- Create a custom status-message.html.twig calling to our new SDC
- Overwrite the status_messages theme function to load a custom status-message.html.twig template instead of the active theme one
- Remove the core/themes/claro/css/components/messages.css file from being loaded

Now, the status messages are being rendered using the our SDC instead of the Claro template.

Missing points:

I could not replicate the logic inside the `claro_preprocess_status_messages` function as reported in https://www.drupal.org/project/sdc/issues/3321203 Have a way to implement the a preprocess function per each SDC component (ideally in the same folder) Active . Once this is done, the components should be identical.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇪🇸Spain unstatu

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024