Problem/Motivation

When not providing any swatches in the field settings, a broken swatch is displayed in the widget without a proper color value. The expected behavior would be to not display any swatches if the swatches array is empty. This problem is caused by the multi-value field for the swatches, since it will deliver an empty value.

Steps to reproduce

1. Add Coloris Color field to some content.
2. Do not add any swatches in the field settings.
3. Go to edit form and check the widget. It displays a broken swatch without a color value. See screenshot.

Broken swatch in widget

CommentFileSizeAuthor
broken_swatch.png98.66 KBsimonbaese

Issue fork coloris-3409205

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

simonbaese created an issue. See original summary.

simonbaese’s picture

Status: Active » Needs review

The problem is caused by the multi-value settings field for the swatches. It also saves empty values. Since the form is initialized with a input field for the "first" value, this empty value gets handed down to the widget.

svenryen made their first commit to this issue’s fork.

svenryen’s picture

Status: Needs review » Needs work

@simonbaese, could you please help re-roll this branch?
(Sorry for late reply) 😃

svenryen’s picture

simonbaese’s picture

Status: Needs work » Needs review
christian.wiedemann’s picture

Thanks!

christian.wiedemann’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.