Validate if the element has valid color before saving

Created on 12 March 2023, over 1 year ago
Updated 25 March 2023, over 1 year ago

First of all congratulations on this theme. Is exactly what I was looking for, and the mobile version is very useful. Thank you so much

Problem/Motivation

I'm using this theme in a PoC and I realized that the editors was able to configure colors without valid HEX code. Example #000000. The form is saved without notify the user that is an invalid color. We know that this is a content issue, but I think we can create a form Validate to verify if the color has a valid HEX code and if not show the error for the editor

Steps to reproduce

  1. Open the settings page admin/appearance/settings/openchurch_theme
  2. In the field "Link color" put a wrong color code, example: "asd"
  3. Save
  4. Result: It'll be saved without any message
  5. Expected: We can put a message for the end user that isn't a valid color

Proposed resolution

Implement a formValidate and use the Color class to validate the HEX code, if isn't valid use form_state->setError to notify the cms editor

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

3.0

Component

Documentation

Created by

🇧🇷Brazil RenatoG Campinas

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

Comments & Activities

Production build 0.69.0 2024